【发布时间】:2016-09-26 05:24:00
【问题描述】:
在 iOS 10 中,有时在安装应用程序时,位置权限提示会打开很多时间并挂起所有应用程序并且无法进一步移动。
这是我在 iOS 10 之前的代码
-(void)startLocationManager{
self.locationManager=[[CLLocationManager alloc]init];
self.locationManager.desiredAccuracy=kCLLocationAccuracyBest;
self.locationManager.delegate=self;
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[self.locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
if (self.myCurrentLocation==nil) {
self.myCurrentLocation=[locations lastObject];
[[WALocationManager WALocationSharedInstance] checkLatestLocation];
}
else{
if (self.myCurrentLocation.horizontalAccuracy < 0){
return;
}
self.myCurrentLocation=[locations lastObject];
if([[WALocationManager WALocationSharedInstance] currentLocation]!=self.myCurrentLocation ){
}
}
}
在我的 plist 文件中,
<key>NSLocationAlwaysUsageDescription</key>
<string>This app will use your location to get most nearyby activity around you.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app will use your location.</string>
【问题讨论】:
-
你在哪里调用了这个 startLocationManager
-
@Anbu.Karthik in appdelegate .. didlaunch
-
你能附上你的项目吗
-
从那里删除并添加一些类并尝试一次
-
对不起,它不是一个演示项目......它在 iOS 9 中的工作,但在 10 中有时会提示这么多,无法由应用程序处理
标签: ios objective-c ios10