hansemannn / titanium-googlemaps

🗺 Use the Google Maps SDK in Titanium
Other
87 stars 26 forks source link

Bug: Crash Using Clusters and Click Event #72

Closed ptsequeira closed 7 years ago

ptsequeira commented 7 years ago

The module crashes when clicking a marker on a map with Cluster Items and MapView Click Event. If i remove the MapView click event, it seems to work fine.

Titanium SDK : 6.0.1 iOS: 10.2

Example:

var mapView = map.createView({
    clusterRanges: [10,50,100,200,500],
    clusterBackgrounds: [
        'images/buckets/m1.png',
        'images/buckets/m2.png',
        'images/buckets/m3.png',
        'images/buckets/m4.png',
        'images/buckets/m5.png'
    ],
    region: {
        latitude: 40.04637,
        longitude: -7.94972
    }
});

mapView.addEventListener("click", handleClickEvent);

var count = 100;
var items = [];

for (var i = 0; i < count; ++i) {
    var clusterItem = map.createClusterItem({
        latitude: getRandomInRange(40,41, 4),
        longitude: getRandomInRange(-7,-8, 4),
        title: 'Annotation ' + i 
    });

    items.push(clusterItem);
}

mapView.addClusterItems(items);
mapView.cluster();

$.main.add(mapView);

Error:

[ERROR] :  The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] :  Reason:
[ERROR] :  -[GMUStaticCluster boundBridge:withKrollObject:]: unrecognized selector sent to instance 0x60000043a280
[ERROR] :  Stack trace:
[ERROR] :  0   CoreFoundation                      0x000000011388cd33 __exceptionPreprocess + 147
[ERROR] :  1   libobjc.A.dylib                     0x000000010e52c21e objc_exception_throw + 48
[ERROR] :  2   CoreFoundation                      0x00000001138fcf04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
[ERROR] :  3   CoreFoundation                      0x0000000113812005 ___forwarding___ + 1013
[ERROR] :  4   CoreFoundation                      0x0000000113811b88 _CF_forwarding_prep_0 + 120
hansemannn commented 7 years ago

It's currently not supported to have both mapView click events and cluster events together. Use clusterclick and clusteritemlick instead. I think they are not documented, yet.

ptsequeira commented 7 years ago

@hansemannn Thanks. Already tested and worked as expected