iOS 8设置CLLocation授权

1. 调用CLLocation前, 添加以下代码:

    // 获取授权

    if ([UIDevice currentDevice].systemVersion.doubleValue >= 8.0)
    {
        // 始终允许访问位置信息
        // [_manager requestAlwaysAuthorization]; // manager应为全局变量

        // 使用应用程序期间允许访问位置信息
        [_manager requestWhenInUseAuthorization];
    }

 

2. 修改info.plist文件:

posted @ 2015-08-04 23:31  HappyPlane  阅读(151)  评论(0)    收藏  举报