【发布时间】:2014-03-31 08:05:45
【问题描述】:
我想在前台和后台连续运行我的进程。我已经实现了以下代码
self.updateTimer = [NSTimer scheduledTimerWithTimeInterval:10.0
target:self
selector:@selector(repeatedMethod)
userInfo:nil
repeats:YES];
self.backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
NSLog(@"Background handler called. Not running background tasks anymore.");
[[UIApplication sharedApplication] endBackgroundTask:self.backgroundTask];
self.backgroundTask = UIBackgroundTaskInvalid;
}];
在前台很好,但在后台进程只运行了 5 分钟,并且运行时间不超过 5 分钟。但我希望它即使在后台也能连续运行。请帮助。
【问题讨论】:
标签: ios iphone ios7 cocos2d-iphone