我在运行后台进程的位置服务中的应用程序工作但 10 分钟后应用程序被关闭。我正在使用以下步骤
1)在 .plist 文件中手动添加密钥
<key>Required background modes</key>
<array>
<string>App registers for location updates</string>
</array>
2)代码是
self.locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
NSString *latVal = [[NSString alloc] initWithFormat:@"%f", newLocation.coordinate.latitude];
NSString *lonVal = [[NSString alloc] initWithFormat:@"%f", newLocation.coordinate.longitude];
}
我需要在没有关闭应用程序的情况下在后台进程中频繁更新,请帮助我。