【发布时间】:2014-10-21 06:10:03
【问题描述】:
当应用程序进入后台但位置未更新时,我使用了以下代码
if(noTripRunning && somethingLeftToSync){
NSLog(@"Bg task started.");
self.bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication] endBackgroundTask:self.bgTask];
self.bgTask = UIBackgroundTaskInvalid;
DebugLog(@"Background task complete.");
}];
}
else if(self.bgTask != UIBackgroundTaskInvalid){
[[UIApplication sharedApplication] endBackgroundTask:self.bgTask];
self.bgTask = UIBackgroundTaskInvalid;
DebugLog(@"Ended background task.");
}
【问题讨论】:
-
显示的代码都与位置无关。
标签: ios background core-location