需要到info.plist文件里,添加量过字段:
NSLocationAlwaysUsageDescription =yes
NSLocationWhenInUseUsageDescription=yes
再添加 [locationManager requestAlwaysAuthorization];
NSLocationAlwaysUsageDescription =yes
NSLocationWhenInUseUsageDescription=yes
再添加 [locationManager requestAlwaysAuthorization];