Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14155] iOS: 'Invalid Region <center:nan, nan span:nan, nan>' with MapView on SDK 3.1.1

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-06-09T23:24:13.000+0000
Affected Version/sRelease 3.1.0, Release 3.2.0
Fix Version/s2013 Sprint 12 API, 2013 Sprint 12, Release 3.1.1, Release 3.2.0
ComponentsiOS
Labelsmodule_map, qe-3.1.1, qe-testadded, regression, triage
ReporterArmindo Da Silva
AssigneeSabil Rahim
Created2013-05-27T11:59:18.000+0000
Updated2013-06-10T09:51:59.000+0000

Description

*Problem* When trying to show a MapView with region and annotations in SDK 3.1.1 I get this error: *Log*
[ERROR] :  The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] :  Reason:
[ERROR] :  Invalid Region <center:nan, nan span:nan, nan>
[ERROR] :  Stack trace:
[ERROR] :  0   CoreFoundation                      0x038fa012 __exceptionPreprocess + 178
[ERROR] :  1   libobjc.A.dylib                     0x033bbe7e objc_exception_throw + 44
[ERROR] :  2   CoreFoundation                      0x03982fb1 -[NSException raise] + 17
[ERROR] :  3   MapKit                              0x023aa78d -[MKMapView setRegion:animated:] + 709
[ERROR] :  4   ligneE                              0x0011e44b -[TiMapView render] + 891
[ERROR] :  5   ligneE                              0x0011ed36 -[TiMapView frameSizeChanged:bounds:] + 294
[ERROR] :  6   ligneE                              0x00099a46 -[TiUIView checkBounds] + 806
[ERROR] :  7   ligneE                              0x00099b47 -[TiUIView setBounds:] + 119
[ERROR] :  8   ligneE                              0x0011ebf5 -[TiMapView setBounds:] + 453
[ERROR] :  9   ligneE                              0x0007cbd0 -[TiViewProxy relayout] + 2016
[ERROR] :  10  ligneE                              0x000808d8 -[TiViewProxy layoutChild:optimize:withMeasuredBounds:] + 1736
[ERROR] :  11  ligneE                              0x0006d54c -[TiViewProxy add:] + 1388
[ERROR] :  12  ligneE                              0x000770ee -[TiViewProxy windowWillOpen] + 1342
[ERROR] :  13  ligneE                              0x00073636 -[TiViewProxy setParent:] + 134
[ERROR] :  14  ligneE                              0x0006d392 -[TiViewProxy add:] + 946
[ERROR] :  15  ligneE                              0x000770ee -[TiViewProxy windowWillOpen] + 1342
[ERROR] :  16  ligneE                              0x000696be -[TiWindowProxy openOnUIThread:] + 190
[ERROR] :  17  ligneE                              0x00069521 __22-[TiWindowProxy open:]_block_invoke + 49
[ERROR] :  18  ligneE                              0x0013a084 __TiThreadPerformOnMainThread_block_invoke + 52
[ERROR] :  19  ligneE                              0x0013a4fc TiThreadProcessPendingMainThreadBlocks + 524
[ERROR] :  20  ligneE                              0x0013a2d9 __TiThreadPerformOnMainThread_block_invoke178 + 57
[ERROR] :  21  libdispatch.dylib                   0x03c0a53f _dispatch_call_block_and_release + 15
[ERROR] :  22  libdispatch.dylib                   0x03c1c014 _dispatch_client_callout + 14
[ERROR] :  23  libdispatch.dylib                   0x03c0c7d5 _dispatch_main_queue_callback_4CF + 296
[ERROR] :  24  CoreFoundation                      0x038a0af5 __CFRunLoopRun + 1925
[ERROR] :  25  CoreFoundation                      0x0389ff44 CFRunLoopRunSpecific + 276
[ERROR] :  26  CoreFoundation                      0x0389fe1b CFRunLoopRunInMode + 123
[ERROR] :  27  GraphicsServices                    0x036817e3 GSEventRunModal + 88
[ERROR] :  28  GraphicsServices                    0x03681668 GSEventRun + 104
[ERROR] :  29  UIKit                               0x011b7ffc UIApplicationMain + 1211
[ERROR] :  30  ligneE                              0x00003ac8 main + 456
[ERROR] :  31  ligneE                              0x000023d5 start + 53
[ERROR] :  2013-05-27 12:46:45.139 ligneE[2475:17b0f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid Region <center:nan, nan span:nan, nan>'
[ERROR] :  *** First throw call stack:
[ERROR] :  (0x38fa012 0x33bbe7e 0x3982fb1 0x23aa78d 0x11e44b 0x11ed36 0x99a46 0x99b47 0x11ebf5 0x7cbd0 0x808d8 0x6d54c 0x770ee 0x73636 0x6d392 0x770ee 0x696be 0x69521 0x13a084 0x13a4fc 0x13a2d9 0x3c0a53f 0x3c1c014 0x3c0c7d5 0x38a0af5 0x389ff44 0x389fe1b 0x36817e3 0x3681668 0x11b7ffc 0x3ac8 0x23d5)
-- End simulator log ---------------------------------------------------------
*Note* This works fine on 3.0.2 GA and previous versions. It seems that the problem occurs with 3.1 GA and above. *Workaround* Add left and right properties to Ti.Map creation. The error will no longer occur.

Comments

  1. Daniel Sefton 2013-05-27

    Can you provide a reproducible test case that we can drop into an app.js and run? Thanks!
  2. Armindo Da Silva 2013-05-28

    Will try to do this.
  3. Sabil Rahim 2013-05-29

    will wait for test code . but have a feeling that this is could be due to the fact that we donot do proper type checking before trying setRegion. If the region being passed in does not have any latitude, longitude and latitudeDelta and longitudeDelta. Will also try to test if that is the actual cause.
  4. Armindo Da Silva 2013-05-29

    Sorry was on a meeting all day. I post it as soon as I can. the MapView is inside a view I wonder if it doesn't affect also... because in one case I have a "normal" window with a navbar and a tabgroup no problem he same code but with a window without a navbar and without tabgroup and here it crash
  5. Armindo Da Silva 2013-06-07

    Hi, I have made a full sample case (sorry for late replay), clicl on the link to download it : http://cjoint.com/?0FhlmfuI9du
  6. Armindo Da Silva 2013-06-07

    the strange thing : using : var mapview = Titanium.Map.createView({ mapType : Titanium.Map.STANDARD_TYPE, region : mapRegionSites, top : "24dp", bottom : tp, left:"0dp", right:"0dp", animate : true, regionFit : true, userLocation : true, annotations : [annotationDepart, annotationArrivee] }); instead of var mapview = Titanium.Map.createView({ mapType : Titanium.Map.STANDARD_TYPE, region : mapRegionSites, top : "24dp", bottom : tp, animate : true, regionFit : true, userLocation : true, annotations : [annotationDepart, annotationArrivee] }); doesn't make it crashing on 3.1X, the only diff here is the left and right property.
  7. Daniel Sefton 2013-06-07

    Tested and confirmed on iOS 6 simulator with Ti SDK 3.1 GA and 3.2 CI.
  8. Sabil Rahim 2013-06-07

    Simplified Test code
       	var window = Ti.UI.createWindow();
       	var self = Ti.UI.createView();
       
       	var isAndroid = false;
       	if (Titanium.Platform.name == 'android') {
       		isAndroid = true;
       	}
       
       	var annotationDepart = Titanium.Map.createAnnotation({
       		pincolor : Titanium.Map.ANNOTATION_GREEN,
       		animate : true
       	});
       
       	var annotationArrivee = Titanium.Map.createAnnotation({
       		pincolor : Titanium.Map.ANNOTATION_RED,
       		animate : true
       	});
       
       
       
       
       	//create the map boundary area values
       	var fact = 1;
       	if (!isAndroid) {
       		fact = 3;
       	}
       
       
       	//create the map region definition for the boundaries containing the sites
       	var mapRegionSites = {
       		latitude : 45.170863999999995,  
       		longitude : 5.7132035000000005,
       		latitudeDelta : 0.004636666666667584,
       		longitudeDelta : 0.001671666666666442
       	};
       
       	Ti.API.info(mapRegionSites);
       
       	//tell the map view to display the region with the sites in
       	//mapview.setLocation(mapRegionSites);
       
       	//
       	// CREATE ANNOTATIONS
       	//
       
       	//
       	// CREATE MAP VIEW
       	//
       
       	var mapToolbar;
       	var tp = "44dp";
       
       	//To do
       	/*
       	 * annotationDepart, annotationArrivee
       	 * tcAnnotations
       	 * routes
       	 * decLatitudeMax = -100000;
       	 * decLatitudeMin = 100000;
       	 * decLongitudeMax = -100000;
       	 * decLongitudeMin = 100000;
       	 */
       
       	var mapview = Titanium.Map.createView({
       		mapType : Titanium.Map.STANDARD_TYPE,
       		region : mapRegionSites,
       		top : "24dp",
       		bottom : tp, //left:0,right:0,
       		animate : true,
       		regionFit : true,
       		userLocation : true,
       		annotations : [annotationDepart, annotationArrivee]
       	});
       
       
           mapview.addEventListener('complete', function(){
           mapview.setRegion(mapRegionSites);
           })
       
       	self.add(mapview);
       
       
       	window.add(self);
       	
       	window.open();
       
  9. Sabil Rahim 2013-06-07

    PR pending master :https://github.com/appcelerator/titanium_mobile/pull/4364 3_1_X: https://github.com/appcelerator/titanium_mobile/pull/4365
  10. Blain Hamon 2013-06-09

    My bad. I thought I pressed the buttons. Buttons now pressed.
  11. Anshu Mittal 2013-06-10

    Tested with: SDK:3.1.1.v20130609163050 Appcelerator Studio: 3.1.1.201306071750 OS: OSX 10.7.5 Device:iPad mini(6.0) Xcode: 4.6

JSON Source