【发布时间】:2014-05-12 05:22:46
【问题描述】:
我已经使用位置更新作为后台模式完成了一个应用程序,并且我在每个 keepAlive 间隔后使用 web 服务更新我的位置。我正在使用下面提到的代码。
if ([application respondsToSelector:@selector(setKeepAliveTimeout:handler:)])
{
[application setKeepAliveTimeout:120 handler:^{
DDLogVerbose(@"KeepAliveHandler");
// Do other keep alive stuff here.
}];
}
self.bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
NSLog(@"ending background task");
[[UIApplication sharedApplication] endBackgroundTask:self.bgTask];
self.bgTask = UIBackgroundTaskInvalid;
}];
self.backgroundTimerForLocationUpdate = [NSTimer scheduledTimerWithTimeInterval:120
target:self
selector:@selector(changeAccuracy)
userInfo:nil
repeats:YES];
在位置委托中,我正在调用一个网络请求来更新服务器中的位置,以跟踪用户。
苹果会拒绝应用使用位置更新后台模式吗?
【问题讨论】:
-
应该没问题...位置后台服务是可以接受的。
标签: ios objective-c cllocationmanager background-process appstore-approval