ios - Google Maps SDK for IOS, map 被阻止,并得到 "Maximum possible coords exceeded"

标签 ios google-maps-sdk-ios

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/

相关文章:

ios - swift 将 Int16 写入 AVAudioPCMBuffer

ios - "Presenting view controllers on detached view controllers is discouraged"呈现模态时的消息

iphone - 在自定义 UINavigationController 中强制执行特定 rootViewController 的推荐方法是什么?

ios - 在谷歌地图 ios 中只获取区域名称?

swift - 移动 GMSPanoramaView 堆积内存

ios - MFMailComposeViewController 删除 rootViewcontroller

iphone - 如何计算ios加速度计水平面

ios - 单击 Google 控制按钮时在 Google map 应用程序中打开.. Swift 4

ios - 同一应用中的 Google Maps SDK 和 Mapkit 导致崩溃

ios - 未调用 GMSMapViewDelegate 方法?