Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获得;空";iOS中使用GMSMap的反向坐标法?_Ios_Objective C_Google Maps_Location_Geocode - Fatal编程技术网

获得;空";iOS中使用GMSMap的反向坐标法?

获得;空";iOS中使用GMSMap的反向坐标法?,ios,objective-c,google-maps,location,geocode,Ios,Objective C,Google Maps,Location,Geocode,我使用以下代码从lat和long获取地址: NSLog(@">>>>%f,%f",location.latitude,location.longitude); [[GMSGeocoder geocoder] reverseGeocodeCoordinate:location completionHandler:^(GMSReverseGeocodeResponse *resp, NSError *error) { NSLog(@"response%@",re

我使用以下代码从lat和long获取地址:

NSLog(@">>>>%f,%f",location.latitude,location.longitude);

[[GMSGeocoder geocoder] reverseGeocodeCoordinate:location completionHandler:^(GMSReverseGeocodeResponse *resp, NSError *error)
 {
     NSLog(@"response%@",resp);
 }];
当我尝试使用正确的lat和long对特定位置进行地理编码时,我得到的响应为null,错误如下。我的android设备不会发生这种情况

我可以看到响应为零,错误为:

Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=https://clients4.google.com/glm/mmap, _kCFStreamErrorCodeKey=-2102, NSErrorFailingURLKey=https://clients4.google.com/glm/mmap, NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=4, NSUnderlyingError=0x1659ae80 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSErrorFailingURLStringKey=https://clients4.google.com/glm/mmap, NSErrorFailingURLKey=https://clients4.google.com/glm/mmap, NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=4}}}

这个问题的出现是因为您的API密钥已过期,如果您在google控制台中重新生成API密钥,它将工作并得到您的响应


API关键示例:
aizasydledurwellp3owlmaozlt4mzwsjmwqvm

如果您使用的是模拟器,请检查模拟器位置设置是否设置为
none
。您可以通过选择模拟器进行检查,并转到:

调试>位置>无


希望能有所帮助。

请看这篇文章,尝试将Google Maps SDK更新为最新版本,检查互联网是否连接。这不是互联网问题,我得到的结果都是正确的,除了ios中的特定位置