更新时间:2022-06-05 01:48:31
对于 IOS 8,您必须将 NSLocationAlwaysUsageDescription
或 NSLocationWhenInUseUsageDescription
键添加到您的 plist.否则它不会请求许可.
For IOS 8 you have to add NSLocationAlwaysUsageDescription
or NSLocationWhenInUseUsageDescription
key to your plist. Otherwise it does not ask for permission.
添加 CLLocationManagerDelegate
add CLLocationManagerDelegate
@implementation Locator <CLLocationManagerDelegate>
- (instancetype) init {
//......
self.locationManager.requestAlwaysAuthorization();
}