Bhu*_*tre 2 objective-c core-location cllocationmanager ios
甚至我的应用程序都在后台注册位置更新.
在我的代码中:
self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers;
self.locationManager.distanceFilter = 2500;
Run Code Online (Sandbox Code Playgroud)
我没有搬到任何地方.因此,在控制台日志中完成15分钟后,我收到此消息"位置图标现在应处于"非活动状态".从这一点开始,我的应用程序不在后台运行.
它只在iPhone 5中发生.
@更新
这是我的代码
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self.locationManager setPurpose:@"Enable Location service for \"My App\" to track your"];
self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers;
/* Notify changes when device has moved x meters.
* Default value is kCLDistanceFilterNone: all movements are reported.
*/
self.locationManager.distanceFilter = 2500;
[self.locationManager startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)
小智 5
当位置服务变为非活动状态时,您的应用是否在后台?
如果您不想在后台暂停位置更新,则需要设置pausesLocationUpdatesAutomatically flag,
if ([self.locationManager respondsToSelector:@selector(pausesLocationUpdatesAutomatically)]) {
self.locationManager.pausesLocationUpdatesAutomatically = NO;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1618 次 |
| 最近记录: |