SDK 1.8.2 LocalNotification crash

You must Login before you can answer or comment on any questions.

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 Simulator
This 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().

— asked 1 year ago by Mark Ruys
3 Comments
  • Thanks for the tip!

    — commented 1 year ago by Nick Milner

  • I can't get a local notification to fire at all

    var params = {
            date: (new Date().getTime() + 10000), 
            repeat: 'weekly',
            alertAction: 'wut!',
            alertBody: 'w00t!',
            badge: 1,
            userInfo: {why: 'me'}
        };
     
    var notif = Ti.App.iOS.scheduleLocalNotification(params);

    — commented 1 year ago by Ed mediahack

  • Ed,

    The userinfo should be like this:

    userInfo: {'why': 'me'}

    — commented 1 year ago by Itinerarium Itinerarium

3 Answers

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!