IOS8之后系统定位需要许可
在info.plist文件添加 NSLocationWhenInUseUsageDescription 和 NSLocationAlwaysUsageDescription。
代码添加定位请求
//必须定义全局变量,否则请求提示一闪即逝
CLLocationManager *locationManager;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
locationManager = [[CLLocationManager alloc]init];
if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[locationManager requestWhenInUseAuthorization];//iOS 8才有,且必须用上
}
}