ios8 定位问题解决思路:
1、plist文件新加两条变量:
a、NSLocationAlwaysUsageDescription=YES; b、NSLocationWhenInUseUsageDescription=YES
2、增加判断是否手机为ios8系统,加权限
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
if(IOS8){
// [locationManager requestAlwaysAuthorization];//始终
[locationManager requestWhenInUseAuthorization];//使用期间//or
}
[locationManager startUpdatingLocation];
3、增加代理方法:
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
switch (status) {
case kCLAuthorizationStatusNotDetermined:
if ([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])
{
[locationManager requestWhenInUseAuthorization];
}
break;
default:
break;
}
}
{
switch (status) {
case kCLAuthorizationStatusNotDetermined:
if ([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])
{
[locationManager requestWhenInUseAuthorization];
}
break;
default:
break;
}
}
ios8系统 点击设置隐私定位功能直接崩溃的问题
这个问题出现的原因肯定不是ios8系统的问题,因为其他app都好的,为什么你的APP就有问题,肯定是你加代码的时候什么地方写错了。
我对照代码找了好几遍,终于发现有个地方和别人的不一样,那就是设置plist文件变量的时候Type类型BOOl应该是String。估计苹果是通过字符串对比来判断的,所以BOOl类型就直接崩溃了。