iOS 8 地图

iOS8修改了位置设置里的内容,增加了一套状态(使用中可用/通常可用),所以以前的CLLcationManage的注册后,
Delegate接口不响应了。
iOS8需要这么设置

第一步 
location = [[CLLocationManager alloc] init]; 

location.delegate= self; 

[location requestAlwaysAuthorization]; 


第二步 

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

第三步 
有了新的Delegate方法。
 
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status 
{ 
    switch (status)
    { 
            case kCLAuthorizationStatusNotDetermined: 
            if ([location respondsToSelector:@selector(requestAlwaysAuthorization)]) 
            { 
            [locationrequestAlwaysAuthorization]; 
            } 
            break; 
        default: 
            break;
} }

 

附上调查过程
https://developer.apple.com/jp/devcenter/ios/library/documentation/LocationAwarenessPG.pdf
http://www.w3c.com.cn/ios8新特性之基于地理位置的消息通知uilocalnotification
http://blog.uniba.jp/post/91830563468/ios-8

posted @ 2014-12-23 12:10  苏糊  阅读(143)  评论(0编辑  收藏  举报