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"
今天真的好高兴呀 我解决了一个折磨了我一周的问题,真的是激动地要哭出来了,为了这个问题,我嘴也烂了,头发抓了一地啊.虽然解决方法,最后还是展现出了“百度”的伟大,但是我还是很开心,在这里我展示一下我的 ...
随机推荐
- bzoj 2818: Gcd GCD(a,b) = 素数
2818: Gcd Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 1566 Solved: 691[Submit][Status] Descript ...
- 使用FindFirstFile,FindNextFile遍历一个文件夹
//遍历文件夹函数 void TraverseFolder(LPCTSTR lpPath) { TCHAR szFind[MAX_PATH] = {_T("\0")}; WIN32 ...
- 适配 iOS尺寸
http://liumh.com/2015/10/21/ios-image-related-matching/ 苹果IPHONE 5主屏尺寸: 4英寸 屏幕尺寸: iPhone 6 Plus 5.5英 ...
- SqlSever基础 ltrim函数 除去字符串左边的空格,右边的中间的不管
镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...
- BASE64,MD5,SHA,HMAC加密與解密算法(java)
package com.ice.webos.util.security; import java.io.UnsupportedEncodingException; import java.math.B ...
- Linux加载DTS设备节点的过程(以高通8974平台为例)
DTS是Device Tree Source的缩写,用来描述设备的硬件细节.在过去的ARM Linux中,arch/arm/plat-xxx和arch/arm/mach-xxx中充斥着大量的垃圾代码, ...
- 编写一个Java程序,计算一下1,2,…,9这9个数字可以组成多少个互不相同的、无重复数字的三位偶数。
package a; public class SanWeiOuShu { public static void main(String[] args) { String str="1234 ...
- 【Unity3D游戏开发】性能优化之缩减打包压缩包大小 (二八)
unity3d打包的所有文件是会被记录而且被排序的.所以这大大方便了我们分析为何打包文件如此之大,以及怎么减少打包文件. 日志目录一般在:C:\Users\Administrator\AppData\ ...
- oracle PL/SQL基础编程
PL/SQL(Procedural Language/SQL)是oracle中引入的一种过程化编程语言 PLS-00103:出现符号"declare"在需要下列之一时 符号&quo ...
- VI编辑器