CLGeocoder Error Domain=kCLErrorDomain Code=2
使用CLGeocoder解码地址时,遇到错误 Error Domain=kCLErrorDomain Code=2
代码:
#pragma mark 跟踪定位代理方法,每次位置发生变化即会执行(只要定位到相应位置)
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
CLLocation *location=[locations firstObject];//取出第一个位置
CLLocationCoordinate2D coordinate=location.coordinate;//位置坐标
NSLog(@"经度:%f,纬度:%f,海拔:%f,航向:%f,行走速度:%f",coordinate.longitude,coordinate.latitude,location.altitude,location.course,location.speed); CLGeocoder *gcode = [[CLGeocoder alloc]init];
[gcode reverseGeocodeLocation:location completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
if (error) {
NSLog(@"%@",error);
}else
{
CLPlacemark *mk = [placemarks objectAtIndex:0];
NSString *state = [mk.addressDictionary objectForKey:@"State"];
NSString *city = [mk.addressDictionary objectForKey:@"City"];
NSString *lity = [mk.addressDictionary objectForKey:@"SubLocality"];
NSString *stret = [mk.addressDictionary objectForKey:@"Street"];
NSString *name = [mk.addressDictionary objectForKey:@"Name"]; }
isGettingLocation = NO;
}]; //如果不需要实时定位,使用完即使关闭定位服务
[_locationManager stopUpdatingLocation];
}
错误原因:
地址解析需要网络,检查网络连接!手机是否断网了
http://stackoverflow.com/questions/29087660/error-domain-kclerrordomain-code-2-the-operation-couldn-t-be-completed-kclerr
CLGeocoder Error Domain=kCLErrorDomain Code=2的更多相关文章
- 根据经纬度反向地理编译出地址信息(如果报错:Error Domain=kCLErrorDomain Code=8 "(null)")
注意:Error Domain=kCLErrorDomain Code=8 "(null)" 如果出现这个错误 一定是 经纬度有问题 一定是 经纬度有问题 一定是 经纬度有问 ...
- [ios] 定位报错Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"
Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error ...
- IOS8解决获取位置坐标信息出错(Error Domain=kCLErrorDomain Code=0)(转)
标题:IOS8解决获取位置坐标信息出错(Error Domain=kCLErrorDomain Code=0) 前几天解决了在ios8上无法使用地址位置服务的问题,最近在模拟器上调试发现获取位置坐标信 ...
- IOS8解决获取位置坐标信息出错(Error Domain=kCLErrorDomain Code=0)
最近在模拟器上调试发现获取位置坐标信息的时候会报错,错误信息: didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation ...
- Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed.
地图定位 错误:使用CoreLocation获取地理位置信息,报错 Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be ...
- didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLError
This error also occurs if you have Scheme/Edit Scheme/Options/Allow Location Simulation checked but ...
- iOS json 解析遇到error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed.
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 38 ...
- ShareSDK 集成 Google+ 登录 400. Error:redirect_uri_mismatch 和 Error Domain=ShareSDKErrorDomain Code=204
最近在集成ShareSDK中 Google+ 登录授权时候 出现了如下几个问题 1. 400. Error:redirect_uri_mismatch 出现这种情况, redirectUri应 ...
- Error Domain=ASIHTTPRequestErrorDomain Code=8 "Failed to move file from"xxx/xxx"to"xxx/xxx"
今天真的好高兴呀 我解决了一个折磨了我一周的问题,真的是激动地要哭出来了,为了这个问题,我嘴也烂了,头发抓了一地啊.虽然解决方法,最后还是展现出了“百度”的伟大,但是我还是很开心,在这里我展示一下我的 ...
随机推荐
- wpfのpack协议
当引用的资源需要做成dll时,要用此协议 协议:pack:// 授权:有两种.一种用于访问编译时已经知道的文件,用application:///.一种用于访问编译时不知道.运行时才知道的文件 ...
- 2016年11月25日 星期五 --出埃及记 Exodus 20:16
2016年11月25日 星期五 --出埃及记 Exodus 20:16 "You shall not give false testimony against your neighbor.不 ...
- 2016年6月23日 星期四 --出埃及记 Exodus 14:20
2016年6月23日 星期四 --出埃及记 Exodus 14:20 coming between the armies of Egypt and Israel. Throughout the nig ...
- javascript实现二分查找
今天做了道笔试题,要求是实现二分查找,当然不难,想了一下,因为没有要求语言就用javascript实现了.当然,期间还是出来了一点问题. ok,上代码 /* * 稳定二分查找 * 作者:吴伟欣 * * ...
- PHP判断用户设备是否是移动设备
摘自http://www.oschina.net/code/snippet_1432190_46913 <?php function isMobile() { // 如果有HTTP_X_WA ...
- Printing Array elements with Comma delimiters
https://www.codewars.com/kata/printing-array-elements-with-comma-delimiters/train/csharp using Syste ...
- TYPES、DATA、TYPE、LIKE、CONSTANTS、STATICS、TABLES
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- ABAP Util代码
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- STL--map
map--概述: 映射(Map)和多重映射(Multimap)是基于某一类型Key的键集的存在,提供对TYPE类型的数据进行快速和高效的检索. l对Map而言,键只是指存储在容器中的某一成员. lMu ...
- updatePanel导致JS失效的解决办法(转)
吐槽下,维护别人之前做的项目好蛋疼,整个页面都是用微软的ajax框架. 今天给repeater用JS写一个hover事件 <script type="text/javascript&q ...