0
我一直试图在应用程序完全关闭时使用重大位置更改,但未提供期望的结果。iOS关闭应用程序时发生重大位置更改检测
我的应用程序应该检测何时开车旅行。为此,我注册了重要的位置更改跟踪,所以应用程序应该在iOS发生重大变化时启动。
在模拟器上,我模拟了一个高速公路驱动器,它工作得很好。然而,在真实设备上,应用程序在以极高速度移动5到10公里后才能启动。
我发现存储其他成功执行该应用程序的应用程序,所以我想知道我的实现的哪个部分是不正确的。
我已经在info plist启用位置背景模式。这是我使用启动显著位置更新代码:
self.significantLocationManager = [[CLLocationManager alloc] init];
self.significantLocationManager.delegate = self;
if ([self.significantLocationManager respondsToSelector:@selector(setAllowsBackgroundLocationUpdates:)]) {
self.significantLocationManager.allowsBackgroundLocationUpdates = YES;
}
[self.significantLocationManager startMonitoringSignificantLocationChanges];
编辑:我已经申请并给予我的应用程序的权限为“总是”使用定位服务。应用程序已经在前景,背景中使用了位置,并且终止了它(但从终止状态启动需要很长时间)。
事实已经如此。我更新了问题。谢谢。 –