[TIMOB-19624] iOS event 'notification' not called any more when the app runs a couple of days
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2018-01-20T14:24:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | ios |
Reporter | Ronald van Woensel |
Assignee | Unknown |
Created | 2015-05-02T22:33:00.000+0000 |
Updated | 2018-08-06T17:41:07.000+0000 |
Description
I got the idea that when the app is running for a few days, the local notifications stop working.
Added some logging to app.js to test this:
{noformat}
Ti.App.iOS.addEventListener('notification',function(e) {
Ti.API.info("APP local notification received: "+JSON.stringify(e));
});
{noformat}
Changed /Library/Application Support/Titanium/mobilesdk/osx/3.5.1.GA/iphone/Classes/TiApp.m to add some logging in the application delegate:
{noformat}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
DebugLog(@"[INFO] TiApp Didreceivelocalnotification");
RELEASE_TO_NIL(localNotification);
localNotification = [[[self class] dictionaryWithLocalNotification:notification] retain];
[[NSNotificationCenter defaultCenter] postNotificationName:kTiLocalNotification object:localNotification userInfo:nil];
}
{noformat}
In the beginning when the app is freshly started everything looks ok:
{noformat}
May 1 00:29:22 iPhone inbeacon[3427] : [INFO] TiApp Didreceivelocalnotification
May 1 00:29:22 iPhone inbeacon[3427] : [INFO] local notification received: {"category":null,"badge":0,"alertAction":"toet","timezone":"Europe/Amsterdam","alertBody":"toet toet nederlands","sound":"UILocalNotificationDefaultSoundName","alertLaunchImage":null,"date":"2015-05-01T10:42:42.825Z","userInfo":{"inbeacon":true,"tid":"305","id":38},"identifier":null,"bubbles":true,"type":"notification","source":{},"cancelBubble":false}
May 1 00:29:22 iPhone inbeacon[3427] : [INFO] APP local notification received: {"category":null,"badge":0,"alertAction":"toet","timezone":"Europe/Amsterdam","alertBody":"toet toet nederlands","sound":"UILocalNotificationDefaultSoundName","alertLaunchImage":null,"date":"2015-05-01T10:42:42.825Z","userInfo":{"inbeacon":true,"tid":"305","id":38},"identifier":null,"bubbles":true,"type":"notification","source":{},"cancelBubble":false}
{noformat}
But if I let the app run for a few days, it stops working:
{noformat}
May 3 00:14:48 iPhone inbeacon[1587] : [INFO] TiApp Didreceivelocalnotification
*<--- missing the notification event here --->*
May 3 00:14:49 iPhone inbeacon[1587] : [DEBUG] Firing app event: resumed
May 3 00:14:49 iPhone inbeacon[1587] : [INFO] app has resumed from the background
May 3 00:14:49 iPhone inbeacon[1587] : [INFO] device/sync with http://api.inbeacon.nl
May 3 00:14:50 iPhone inbeacon[1587] : [INFO] device/sync: No refresh -> already synced to version 175
{noformat}
This is fixed since a while. We refactored the way notifications are handled internally to ensure they get queued on app-launch.
Closing as a duplicate. If this is in error, please reopen.