Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.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/3/sql-server-2005/2.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 CLGeocoder反向地理位置不适用于模拟位置_Ios_Objective C_Xcode_Location_Clgeocoder - Fatal编程技术网

Ios CLGeocoder反向地理位置不适用于模拟位置

Ios CLGeocoder反向地理位置不适用于模拟位置,ios,objective-c,xcode,location,clgeocoder,Ios,Objective C,Xcode,Location,Clgeocoder,我通过XCode检查方案启用了位置模拟允许位置模拟并从下拉菜单中选择样本位置-美国纽约州纽约市 这是我从位置获取位置信息的代码。 currentLocation是从CLLocationManager获取的,我看到值正好是从NewYork位置获取的 - (void) fetchPlacemarks: (CLLocation*) currentLocation { // Reverse-geolocate the current location CLGeocoder* geoCoder =

我通过XCode检查方案启用了位置模拟
允许位置模拟
并从下拉菜单中选择样本位置-
美国纽约州纽约市

这是我从位置获取位置信息的代码。
currentLocation
是从
CLLocationManager
获取的,我看到值正好是从
NewYork
位置获取的

- (void) fetchPlacemarks: (CLLocation*) currentLocation
{
  // Reverse-geolocate the current location
  CLGeocoder* geoCoder = [[CLGeocoder alloc] init];
  [geoCoder reverseGeocodeLocation: currentLocation
                 completionHandler: ^(NSArray<CLPlacemark*>* placemarks,
                                      NSError*               error)
   {
      // getting error "The operation couldn’t be completed. (kCLErrorDomain error 8.)"
   }
}
-(void)fetchPlacemarks:(CLLocation*)currentLocation
{
//反向地理定位当前位置
CLGeocoder*geoCoder=[[CLGeocoder alloc]init];
[地理编码器反向地理位置:当前位置]
completionHandler:^(NSArray*位置标记,
N错误*错误)
{
//获取错误“操作无法完成。(kCLErrorDomain错误8)”
}
}
我已经用模拟器和具有真实位置(不是模拟)的设备进行了测试,但它们工作起来很有魅力。 只是它在模拟位置的设备中不起作用。
这里出了什么问题?

在真实设备上,你只能通过调试器进行模拟,看这里

是的。我以调试模式运行应用程序。我的当前位置与模拟位置(纽约)完全相同。通过编辑模式设置默认位置(产品->模式->编辑模式->运行(左面板)->选项(选项卡)->检查“允许位置模拟器”)=>从下拉列表中选择位置=>在设备上调试测试项目=>断开数据电缆,然后开始测试所需的应用程序否,这不是答案。