重要的更改位置服务不会在iPhone 7 plus上触发,但可以在其他设备上运行。请帮忙 ... 。 我试过以下代码
[appDelegate.locationManager stopUpdatingLocation];
appDelegate.locationManager=nil;
appDelegate.locationManager=[[CLLocationManager alloc]init];
if(IS_OS_8_OR_LATER)
{
[appDelegate.locationManager requestAlwaysAuthorization];
}
if ([appDelegate.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])
{
[appDelegate.locationManager requestAlwaysAuthorization];
//flag=1;
}
appDelegate.locationManager.delegate = appDelegate.self;
if(IS_OS_9_OR_LATER) {
appDelegate.locationManager.allowsBackgroundLocationUpdates=YES;
}
//appDelegate.locationManager
appDelegate.locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
appDelegate.locationManager.distanceFilter = 200;
//locationManager.activityType=CLActivityTypeOtherNavigation;
appDelegate.locationManager.pausesLocationUpdatesAutomatically=NO;
[appDelegate.locationManager startMonitoringSignificantLocationChanges];
本规范不适用于iPhone 7 plus,但适用于其他设备和iOS 10操作系统。