1.由于IOS8中定位的授权机制改变,需要进行手动授权
//声明变量CLLocationManager,一定要在.h文件中声明,否则会出现授权提示框不出现或者闪过的问题。
- @property (nonatomic, strong) CLLocationManager *locationManager;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) {
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
//获取授权认证
[locationManager requestAlwaysAuthorization];
[locationManager requestWhenInUseAuthorization];
}
2.在info.plist中加入键值对
NSLocationAlwaysUsageDescription=YES
NSLocationWhenInUseUsageDescription=YES
3.如果还是不行,更新地图key,重新生成.