Ok , im not getting answers about this. :(
Multipeer Connectivity audio streaming stop work on background
What about this?
i'm trying to run this code on background.
- (void)applicationDidEnterBackground:(UIApplication *)application {
__block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
[application endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSTimer *aTimer = [NSTimer timerWithTimeInterval:3
target:self
selector:@selector(showInformation)
userInfo:nil
repeats:YES];
[[NSRunLoop mainRunLoop]
addTimer:aTimer
forMode:NSDefaultRunLoopMode];
[application endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
});
}
Obviously i ihave this function defined on the same scope
- (void) showInformation {
NSLog(@"showInformation is called.");
}
But when i put the app on background, the interval message, stop work and when i come back to the foreground continue working ........
This means is not running on the background?.
Is this possible? or am I trying to do something stupidly impossible?
I really appreciate some help.
Thanks a lot.