Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.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谷歌地图:坐标不匹配_Ios_Iphone_Google Maps - Fatal编程技术网

iOS谷歌地图:坐标不匹配

iOS谷歌地图:坐标不匹配,ios,iphone,google-maps,Ios,Iphone,Google Maps,我们的应用程序的一个特性是在地图上绘制一个位置,我们将它保存在服务器中,并在应用程序的主屏幕上显示。我们使用的是谷歌地图和GMSMarker,draggable属性设置为YES。但标记位置与获得的坐标之间存在差异 代码: NSDictionary *signDict = self.imgLocationsArray[_currentIndex]; _toSaveLat = [signDict[TAG_SIGN_LAT

我们的应用程序的一个特性是在地图上绘制一个位置,我们将它保存在服务器中,并在应用程序的主屏幕上显示。我们使用的是谷歌地图和GMSMarker,draggable属性设置为YES。但标记位置与获得的坐标之间存在差异

代码:

    NSDictionary *signDict             = self.imgLocationsArray[_currentIndex];
_toSaveLat                         = [signDict[TAG_SIGN_LAT] floatValue];
_toSaveLon                         = [signDict[TAG_SIGN_LONG] floatValue];

GMSCameraPosition *camera          = [GMSCameraPosition cameraWithLatitude:_toSaveLat longitude:_toSaveLon zoom:GOOGLE_MAPS_DEFAULT_ZOOM_LEVEL];
self.dragDropMap                   = [GMSMapView mapWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) camera:camera];
[self.dragDropMap setMapType:kGMSTypeNormal];
[self.dragDropMap setDelegate:self];
self.dragDropMap.myLocationEnabled = YES;
[self.view addSubview:self.dragDropMap];

if (draggingMarker) {
draggingMarker.map                 = nil;
draggingMarker                     = nil;
}
draggingMarker                     = [[GMSMarker alloc] init];
draggingMarker.icon                = [GMSMarker markerImageWithColor:[UIColor plumColor]];//[UIImage imageNamed:@"MoveablePin"];
draggingMarker.position            = CLLocationCoordinate2DMake(_toSaveLat, _toSaveLon);
draggingMarker.tappable            = NO;
draggingMarker.draggable           = YES;
draggingMarker.map                 = self.dragDropMap;

-(void)mapView:(GMSMapView *)mapView didEndDraggingMarker:(GMSMarker *)marker{
NSLog(@"marker dragged to location: %f,%f", marker.position.latitude, marker.position.longitude);
_toSaveLat                         = marker.position.latitude;
_toSaveLon                         = marker.position.longitude;
}

我是不是在代码中遗漏了什么?请建议一个解决方案或解决方法来修复此问题。谢谢

测试环境

  • xCode-7.0
  • 谷歌地图SDK版本-1.10.3(使用pod)
  • 设备-iPhone 5S、iPhone 6plus
  • iOS-9.0.2

不确定您的问题,但代码缩进看起来像堆栈跟踪!:')我在xcode中使用格式化程序。猜猜看,很难读懂它|您正在使用哪个提供商?你检查过返回位置的准确性了吗?是的。准确度似乎是正确的。我发现,当我使用较小的图像作为标记时,它可以100%准确地给出准确的位置。。