iOS疯狂详解之适配百度地图授权问题

来源:互联网 发布:mac浏览器插件删除 编辑:程序博客网 时间:2024/05/16 12:59

iOS8修改了位置设置里的内容,增加了一套状态(使用中可用/通常可用),所以以前的CLLcationManage的注册后, 

Delegate接口不响应了。 

  iOS8需要这么设置 

第一步 

    location = [[CLLocationManageralloc]init]; 

location.delegate=self; 

[locationrequestAlwaysAuthorization]; 

第二步 

在Plist中追加下面两个字段 (必须有,最少一个,内容是系统ALert的文言,文言可为空) 

第三步 

有了新的Delegate方法。 

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status 

    switch (status) { 

casekCLAuthorizationStatusNotDetermined: 

            if ([location respondsToSelector:@selector(requestAlwaysAuthorization)]) { 

[locationrequestAlwaysAuthorization]; 

            } 

            break

        default

            break

 

 

    } 

}

0 0
原创粉丝点击