iOS 获取用户授权的用户隐私保护-地图定位

获取用户授权的用户隐私保护
地图定位示例
//导入定位框架
#import<CoreLocation/CoreLocation.h>

@interfaceViewController()<CLLocationManagerDelegate>

//设置定位对象
@property(nonatomic,strong)CLLocationManager* maneger;

@end

@implementationViewController

- (void)viewDidLoad {
    [superviewDidLoad];

   //当使用iOS8定位的时候需要请求用户授权,且在info.plist里添加字段NSLocationAlwaysUsageDescription请求用户授权的描述
   // iOS7仅仅需要在info.plist里添加字段Privacy - Location Usage Description请求用户授权的描述
   //不需要再写下面的代码
   if(IOS8) {
        [self.manegerrequestAlwaysAuthorization];//请求用户授权
    }

   //开启定位
    [self.manegerstartUpdatingLocation];

}

原文地址:https://www.cnblogs.com/yujidewu/p/6101998.html