SDK 1.8.2 introduced a new bug for local notifications. If you create such a notification like:
var notif = Titanium.App.iOS.scheduleLocalNotification({..});and your release the
notif variable, it gets garbage collected in a few seconds. This crashes the app, sometimes logging error messages as:MyApp(9217,0xac9072c0) malloc: *** error for object 0x9cdbc20: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug MyApp(9217,0xac9072c0) malloc: *** error for object 0x9cdc400: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug MyApp(9217,0xac9072c0) malloc: *** error for object 0x9cdc770: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug [INFO] Application has exited from SimulatorThis also happens if you create notifications without assigning it to a variable. Also, don't try to
notif.cancel() for the same reason.
We don't have to wait until Appcelerator decides to fix the issue as we have a work around: make sure the variable notif is in the global namespace and never gets released. Then you're okay.
To cancel notifications, use Ti.App.iOS.cancelAllLocalNotifications().
3 Answers
Do you know if this bug has been notified to Appcelerator?
I notified it because it is quite annoying ... moreover, it was working fine before (Ti 1.7.3)
After struggling with this issue I found a workaround that has worked for me. Use this module: https://github.com/benbahrenburg/LocalNotify
It handles notifications in a different way and it even lets you check which ones are active and haven't been fired.
Your Answer
Think you can help? Login to answer this question!