I have a problem with local notifications. App crashes when trying to get back in app with local notification.
I copied the Kitchen Sink sample but modified a bit the bg.js.
In bg.js, there is something like this:
Titanium.App.addEventListener('whatever', function(e){
var myNotification = Titanium.App.iOS.scheduleLocalNotification({
alertBody: msg_body,
alertAction: "Yup",
userInfo: {"key": "value"},
date:new Date(new Date().getTime())
});
});
Well, this is not my exact code, but this is the spirit. I tried to remove everything useless, but can’t find the answer…
Here is the crash report header: https://gist.github.com/956064
Is this is a somewhat documented problem?
EDIT: typo in code.
I cannot speak one way or the other to your use of an event listener, but the core problem here is the application crashing. This is caused because you are creating multiple localNotifications with the same variable name. The solution to your problem is to ensure that you do not use the same variable name each time you schedule a localNotification, so use something like an array instead. I had the same problem and it was a 30 second fix to toss the definition into an array, as such: