Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2455] Ti.Map: iOS - Calling removeAllAnnotations when using clusters throws error

GitHub Issuen/a
TypeBug
PriorityCritical
StatusResolved
ResolutionFixed
Resolution Date2018-09-05T08:45:27.000+0000
Affected Version/sn/a
Fix Version/sTi.Map iOS 3.1.1
Componentsn/a
Labelsclustering, ios, maps
ReporterMike Stancliffe
AssigneeVijay Singh
Created2018-08-20T18:58:11.000+0000
Updated2018-09-05T08:45:27.000+0000

Description

In the sample app click "add annotations" and then click "remove annotations". If you remove the 2 types of annotations separately, like I have commented out in the remove function, it seems to work without issue. error should resemble [ERROR] : Script Error { [ERROR] : column = 29; [ERROR] : line = 105; [ERROR] : message = "Invalid type passed to function"; [ERROR] : nativeLocation = "-[TiMapViewProxy annotationFromArg:] (TiMapViewProxy.m:163)"; [ERROR] : nativeReason = "expected: Object, was: MKClusterAnnotation"; [ERROR] : nativeStack = "3 MapClustering problems 0x00000001089bd379 -[TiProxy throwException:subreason:location:] + 105\n4 MapClustering problems 0x0000000108ba880f -[TiMapViewProxy annotationFromArg:] + 347\n5 MapClustering problems 0x0000000108baaa9a -[TiMapViewProxy removeAllAnnotations:] + 406\n6 CoreFoundation 0x000000011139336c __invoking___ + 140\n7 CoreFoundation 0x0000000111393240 -[NSInvocation invoke] + 320\n8 MapClustering problems 0x00000001088f5cdd -[KrollMethod call:] + 2045\n9 MapClustering problems 0x00000001088f45a1 __KrollCallAsFunction_block_invoke + 49\n10 MapClustering problems 0x00000001089fb4bd TiThreadPerformOnMainThread + 77\n11 MapClustering problems 0x00000001088f424e KrollCallAsFunction + 702\n12 JavaScriptCore 0x000000010988b940 _ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE4callEPNS_9ExecStateE + 512\n13 JavaScriptCore 0x0000000109996cd1 _ZN3JSC5LLInt9setUpCallEPNS_9ExecStateEPNS_11InstructionENS_22CodeSpecializationKindENS_7JSValueEPNS_17LLIntCallLinkInfoE + 577\n14 JavaScriptCore 0x000000010999ff4d llint_entry + 27269\n15 JavaScriptCore 0x00000001099992e0 vmEntryToJavaScript + 304\n16 JavaScriptCore 0x000000010982a1df _ZN3JSC7JITCode7executeEPNS_2VMEPNS_14ProtoCallFrameE + 127\n17 JavaScriptCore 0x00000001097f0871 _ZN3JSC11Interpreter11executeCallEPNS_9ExecStateEPNS_8JSObjectENS_8CallTypeERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 433\n18 JavaScriptCore 0x00000001094e14d2 _ZN3JSC12profiledCallEPNS_9ExecStateENS_15ProfilingReasonENS_7JSValueENS_8CallTypeERKNS_8CallDataES3_RKNS_7ArgListE + 178\n19 JavaScriptCore 0x00000001098eb29d JSObjectCallAsFunction + 461"; [ERROR] : sourceURL = "file:///Users/mikestancliffe/Library/Developer/CoreSimulator/Devices/36D76DE8-F88D-40AA-A46E-7D2B8BBD7247/data/Containers/Bundle/Application/4DAF6BFF-CEDD-4439-94A4-DA4293EAD45C/MapClustering%20problems.app/alloy/controllers/index.js"; [ERROR] : stack = " at [native code]\n at remove@file:///Users/mikestancliffe/Library/Developer/CoreSimulator/Devices/36D76DE8-F88D-40AA-A46E-7D2B8BBD7247/data/Containers/Bundle/Application/4DAF6BFF-CEDD-4439-94A4-DA4293EAD45C/MapClustering%20problems.app/alloy/controllers/index.js:105:29)"; [ERROR] : }

Attachments

FileDateSize
index.js2018-08-20T18:54:29.000+00001289
index.xml2018-08-20T18:54:45.000+0000268

Comments

  1. Sharif AbuDarda 2018-08-20

    Hello, I have tested the issue. I was able to reproduce the issue on our end. Removing annotation does cause the issue as described. I will forward this to our engineering. Thanks.
  2. Vijay Singh 2018-09-04

    PR - https://github.com/appcelerator-modules/ti.map/pull/246 Test Case -
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       var mapContainer = Ti.UI.createView({
           bottom: 50
       });
       
       var addBtn = Ti.UI.createButton({
           title: 'Add Annotations',
           bottom: 0,
           left: 20
       });
       
       var removeBtn = Ti.UI.createButton({
           title: 'Remove Annotations',
           bottom: 0,
           left: 150
       });
       
       var clusters = [];
       var points = [];
       
       var Map = require('ti.map');
       var map = Map.createView();
       map.addEventListener('clusterstart', cluster);
       
       
       function add(e) {
           map.removeAnnotations(points);
           map.removeAnnotations(clusters);
           
           clusters = [];
           points = [];
           
           var lat = 29.951318;
           var long = -90.080998;
           
           
           
           for(var x = 0; x<200; x++ ){
               var point = Map.createAnnotation({
                       clusterIdentifier: 'a',
                       latitude: parseFloat(lat),
                       longitude: parseFloat(long),
                       title: x,
                       subtitle: lat +' - '+long,
                       index: x,
                   });
       
               points.push(point);
               
               console.warn(lat +' - '+long);
               
               lat = lat+parseFloat( (Math.random() * .1)); 
               long = long+parseFloat( (Math.random() * .1)); 
           }
           
           console.log('ADD ANNOTATIONS');
           map.addAnnotations(points);
       }
       
       function remove(){
           map.removeAllAnnotations();
           
           // $.map.removeAnnotations(points);
           // $.map.removeAnnotations(clusters);
       }
       
       function cluster(e) {
           Ti.API.info('clustering started');
           var clusterAnnotation = Map.createAnnotation({
               showAsMarker: true,
               markerText: e.memberAnnotations.length.toString() + '+',
           });
       
           clusters.push(clusterAnnotation);
       
           map.setClusterAnnotation({
               annotation: clusterAnnotation,
               memberAnnotations: e.memberAnnotations
           });
       }
       
       addBtn.addEventListener('click', function(e) {
        add();
       });
       
       removeBtn.addEventListener('click', function(e) {
        remove();
       });
       
       mapContainer.add(map);
       win.add(addBtn);
       win.add(removeBtn);
       win.add(mapContainer);
       win.open();
       
  3. Vijay Singh 2018-09-05

    [~cliff_stander] Can you please verify with https://github.com/appcelerator-modules/ti.map/releases (iOS-3.1.1) .Thanks!

JSON Source