cordova-plugin-dialogs
cordova-plugin-dialogs copied to clipboard
(ios) Fix warning in CDVNotification.m: Cast to smaller integer type 'int' from 'void *'
Platforms affected
iOS
Motivation and Context
Xcode reports warning in CDVNotification.m in soundCompletionCallback (callback function of AudioServicesAddSystemSoundCompletion playBeep).
Description
-
In order to implement an loop counter an
intwas passed to the callback function (which requiresvoid*) so internally a cast fromvoid*tointwas required. However, this is a fragile approach and recent versions of Xcode warns about this. -
Instead of using a raw
intvalue I changed toNSNumberwhich is is a pointer and can be retained while the beep is being played. -
I wrote the code to support ARC and non-ARC code as same as surrounding code.
Testing
Play beep works normally. No visible changes for users as expected.
Checklist
- [x] I've run the tests to see all new and existing tests pass
- [x] I added automated test coverage as appropriate for this change
- [x] Commit is prefixed with
(platform)if this change only applies to one platform (e.g.(android)) - [x] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
- [x] I've updated the documentation if necessary