I have a question about the background modes in iOS.
I want to run an timer, that checks an xml file for receiving local notifications every ... 5 minutes.
is this possible? And for how long will it run?
I'm throwing this into applicationDidFinishLaunching
The first time it will run for an ... ~ 5 minutes then the timer stops. After I reopen the app, it starts running again but when going back to background it won't anymore..
I want to run an timer, that checks an xml file for receiving local notifications every ... 5 minutes.
is this possible? And for how long will it run?
I'm throwing this into applicationDidFinishLaunching
Code:
UIBackgroundTaskIdentifier bgTask;
UIApplication *app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
}];
self.notificationTimer = [NSTimer scheduledTimerWithTimeInterval:300 target:self
selector:@selector(checkNotifications) userInfo:nil repeats:YES];
The first time it will run for an ... ~ 5 minutes then the timer stops. After I reopen the app, it starts running again but when going back to background it won't anymore..
Last edited: