ios8 地图定位失败解决办法
2014-11-18 14:57
288 查看
iOS8修改了位置设置里的内容,增加了一套状态(使用中可用/通常可用),所以以前的CLLcationManage的注册后, Delegate接口不响应了。 iOS8需要这么设置
第一步
location = [[CLLocationManager alloc] init];
location.delegate= self;
[locationrequestAlwaysAuthorization];
第二步 在Plist中追加下面两个字段 (必须有,最少一个,内容是系统ALert的文言,文言可为空) NSLocationWhenInUseDescriptionNSLocationAlwaysUsageDescription
第三步 有了新的Delegate方法。
<pre name="code" class="objc">- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
switch (status)
{
case kCLAuthorizationStatusNotDetermined:
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])
{
[self.locationManager requestAlwaysAuthorization];
}
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
转自http://www.cocoachina.com/bbs/read.php?tid=217107&page=1&toread=1#tpc
第一步
location = [[CLLocationManager alloc] init];
location.delegate= self;
[locationrequestAlwaysAuthorization];
第二步 在Plist中追加下面两个字段 (必须有,最少一个,内容是系统ALert的文言,文言可为空) NSLocationWhenInUseDescriptionNSLocationAlwaysUsageDescription
第三步 有了新的Delegate方法。
<pre name="code" class="objc">- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
switch (status)
{
case kCLAuthorizationStatusNotDetermined:
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])
{
[self.locationManager requestAlwaysAuthorization];
}
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
转自http://www.cocoachina.com/bbs/read.php?tid=217107&page=1&toread=1#tpc
相关文章推荐
- Android 百度地图可以定位,但无法显示地图 的解决办法
- 解决ios8 webView加载的地图无法定位问题
- ios8地理位置开发解决定位失败问题
- 局域网访问ArcgisServer 地图失败解决办法
- IOS8下,百度地图无法定位解决办法,亲测可用
- iOS8定位代理方法不回调,解决办法
- 手机端网页使用html5地理定位获取位置失败的解决办法
- IOS8下,百度地图无法定位解决办法
- IOS8下,百度地图无法定位解决办法
- XCode6中定位失败的解决办法
- 高德地图 定位失败,10: 定位服务启动失败 解决办法
- 关于高德地图Android开发时地图只显示一次、第二次打开不定位的解决办法
- 最新关于高德地图定位失败10:定位服务启动、解决办法
- 百度地图启动定位服务LocationClient失败解决办法
- IOS8下,百度地图无法定位解决办法,亲测可用
- IOS8下,百度地图无法定位解决办法
- ios8用CLLocationManager定位获取经纬度,不执行代理的方法的解决办法
- ArcMap发布地图服务报错:001270:合并数据失败的解决办法
- 高德地图定位INVALID_USER_SCODE解决办法
- xcode6和ios 8,定位失败解决办法