Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5287] Ti.Map: iOS crash when hiding/showing notifications after selecting annotation

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionDuplicate
Resolution Date2017-10-17T09:21:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator Modules
Labelsios, ti.map
ReporterMichael Gangolf
AssigneeHans Knöchel
Created2017-10-17T07:42:02.000+0000
Updated2017-10-17T09:58:03.000+0000

Description

*Problem:* App closes without showing any error when doing the following: * select an annotation * click the switch button (it will remove all annotations and show them again) * select a different annotation * click the switch button again * app will crash *Error:* App closes and I only have this error in the device log:
Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib               	0x2240867a objc_retain + 10
1   MapKit                        	0x2bec9776 -[MKAnnotationManager dequeueReusableAnnotationRepresentationWithIdentifier:] + 110
2   test_map                      	0x004ce500 0x102000 + 3982592
3   MapKit                        	0x2bf03314 -[MKMapView annotationManager:representationForAnnotation:] + 336
4   MapKit                        	0x2bec93a8 -[MKAnnotationManager _addRepresentationForAnnotation:] + 340
5   MapKit                        	0x2bec7f9a -[MKAnnotationManager updateVisibleAnnotations] + 1190
6   Foundation                    	0x2347e654 __NSFireTimer + 64
7   CoreFoundation                	0x22c1658e __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
8   CoreFoundation                	0x22c161c0 __CFRunLoopDoTimer + 936
9   CoreFoundation                	0x22c1400c __CFRunLoopRun + 1484
10  CoreFoundation                	0x22b63228 CFRunLoopRunSpecific + 520
11  CoreFoundation                	0x22b63014 CFRunLoopRunInMode + 108
12  GraphicsServices              	0x24153ac8 GSEventRunModal + 160
13  UIKit                         	0x27237188 UIApplicationMain + 144
14  test_map                      	0x00108c40 0x102000 + 27712
15  libdyld.dylib                 	0x2280b872 start + 2
*Code:*
var Map = require('ti.map');
var win = Titanium.UI.createWindow();
var ar = [];

for (var i = 0; i < 20; ++i) {
	var mountainView = Map.createAnnotation({
		latitude: 37 + (Math.random() * 5),
		longitude: -122 + (Math.random() * 5),
		title: "Appcelerator Headquarters",
		subtitle: 'Mountain View, CA',
		pincolor: Map.ANNOTATION_RED,
	});
	ar.push(mountainView);
}

var mapview = Map.createView({
	mapType: Map.NORMAL_TYPE,
	region: {
		latitude: 37.3,
		longitude: -122.3,
		latitudeDelta: 0.5,
		longitudeDelta: 0.5
	},
	animate: true,
	regionFit: true,
	userLocation: true
});

mapview.setAnnotations(ar);

var btn1 = Ti.UI.createButton({
	title: "switch",
	bottom: 10
});

btn1.addEventListener("click", function(e) {
	mapview.removeAllAnnotations();
	setTimeout(function() {
		mapview.setAnnotations(ar);
	}, 1000);
});
win.add(mapview);
win.add(btn1);
win.open();
Module: Ti.Map 3.0.0 Platform: iOS (device and simulator) Android is working with the example from above

Comments

  1. Hans Knöchel 2017-10-17

    Looks like MOD-2371, can you try [this build](https://www.dropbox.com/s/br7cgoh3xqe7tmc/ti.map-iphone-2.12.3.zip?dl=0) as well? *EDIT 1*: I am able to reproduce the issue with 2.12.x / 3.0.0, but I am not able to reproduce the crash with the provided build. Awaiting feedback until 2.12.3 / 3.0.1 gets released. *EDIT 2*: New releases [here](https://github.com/appcelerator-modules/ti.map/releases)!
  2. Michael Gangolf 2017-10-17

    3.0.1 fixed the issue! Thank you for the quick fix (y)

JSON Source