I need to execute one method at a intervals of 1min for every 30min. After 30mins, i want to sleep app for next 30mins.
I tried with UIBackgroundTaskIdentifier API, it allow me to execute code only for 180sec not more than that.
I dont want to use silent remote notifications.
Using NSTimer and NSRunLoop i have achieved this , but i wonder will apple reject my app when i submit.
please help me guys.
- (void)applicationDidEnterBackground:(UIApplication *)application {
[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
NSTimer *loop = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(insideLoop) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:loop forMode:NSRunLoopCommonModes];
}
-(void)insideLoop {
NSLog(@"insideLoop");
}