SDK版本:1.1.0.2080
在 iOS 6 上
map 上大约有10~50个标记,并通过用户操作刷新一些相同或不同的标记。
每次刷新标记时, map 都会进行 fitBounds 动画和[ map 清除]。
当刷新次数太多时(总共刷新了大约1000+个标记),我得到了
超出了最大可能的坐标(10000):控制台中的 32768
并且所有内容都被阻止。
在GMSMapView.h中,clear
的文档是:
/**
* Clears all markup that has been added to the map, including markers,
* polylines and ground overlays. This will not clear the visible location dot
* or reset the current mapType.
*/
- (void)clear;
这是我的刷新功能:
- (void)reloadMarkers:(NSMutableArray *)items fitbounds:(BOOL)fitbounds withVisibleRect:(CGRect)visibleRect
{
[_map clear];
if ([items count] == 0) {
return;
}
if (fitbounds) {
[self fitBounds:items withVisibleRect:visibleRect];
}
for (NSDictionary *item in items) {
GMSMarkerOptions *options = [[GMSMarkerOptions alloc] init];
options.position = CLLocationCoordinate2DMake([[item valueForKey:@"lat"] doubleValue], [[item valueForKey:@"lng"] doubleValue]);
options.title = [item valueForKey:@"name"];
options.userData = item;
UIImage *img = [UIImage imageNamed:[setting valueForKey:[item valueForKey:@"icon"]]];
options.icon = img;
[_map addMarkerWithOptions:options];
}
}
如果您提供有关如何解决问题的任何反馈/经验,我将不胜感激。
最佳答案
这似乎可能是 SDK 中的一个错误,您可以在这里提出问题:
https://code.google.com/p/gmaps-api-issues/issues/entry?template=Maps%20SDK%20for%20iOS%20-%20Bug
同时,也许您可以通过重用以前添加的标记(即更新其位置、标题等)来解决该问题,而不是删除旧标记并添加新标记。
关于ios - Google Maps SDK for IOS, map 被阻止,并得到 "Maximum possible coords exceeded",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15755997/