在地图上添加注释会导致应用程序崩溃[Titanium]

时间:2014-11-13 12:43:34

标签: android ios titanium google-maps-android-api-2

我需要在地图上添加大约1000个注释。这是我的代码片段:

nsNearby.markersSetup = function() {
 var location = Alloy.Globals.playgroungLocationList.locations;
 var annotationData = [];
 for (var i = 0,
    len = Alloy.Globals.playgroungLocationList.locations.length; i < len; i++) {

    var mapAnnotation = nsNearby.mapModule.createAnnotation({
        latitude : location[i].latitude,
        longitude : location[i].longitude,
        title : location[i].name,
        subtitle : location[i].street
    });

    if (Titanium.Platform.osname === "android") {
        mapAnnotation.pincolor = nsNearby.mapModule.ANNOTATION_BLUE;
    } else {
        mapAnnotation.pincolor = nsNearby.mapModule.ANNOTATION_PURPLE;
    }

    nsNearby.mapView1.region = {
        latitude : location[i].latitude,
        longitude : location[i].longitude,
        latitudeDelta : 1,
        longitudeDelta : 1
    };
    annotationData.push(mapAnnotation);

  }
  nsNearby.mapView1.setAnnotations(annotationData);
};

在iOS中,它运行良好,但在Android中,应用程序在添加注释时崩溃。

如果我放了一些特定数量的注释,它就可以了。

可能是因为放置注释时会产生额外负载。但是,有没有办法实现这个目标?

提前致谢!

0 个答案:

没有答案