I've narrowed everything down to this - if I add Annotations (which work perfectly fine on iOS Simulator and Device) to map, then the Application instantly crashes on Launch.
This is my code and Log:
// Check if the Platform is Android, if so, I need to determine which images to use // This is so due to the bug that existed up to Titanium version 2.0 and I haven't checked if it's still there (the correct image isn't automatically picked out from the corresponding folder, like Resources/android/res-long-land-hdpi/, etc.) if (Ti.Platform.osname === "android") { dpi = Titanium.Platform.displayCaps.dpi; if (dpi < 160) { prefix = 'l'; } else if (dpi >= 160 && dpi < 240) { prefix = 'm'; } else if (dpi >= 240 && dpi < 320) { prefix = 'h'; } else if (dpi >= 320) { prefix = 'x'; } else { prefix = 'm'; } pinButton = "/images/" + prefix + "RightArrow.png"; pinImage = "/images/" + prefix + "Pin.png"; } else { // On iPhone things are much more simple, and everything just works. pinButton = Titanium.UI.iPhone.SystemButton.DISCLOSURE; pinImage = null; } // mapData is an Array that is pulled from SQLite with information like latitude, longitute, address, text, etc. // So I'm creating an Annotation for each pin, and pushing them all into an array allPins = (function() { var _i, _len, _results; _results = []; for (_i = 0, _len = mapData.length; _i < _len; _i++) { pin = mapData[_i]; _results.push(Ti.Map.createAnnotation({ entryid: pin.id, latitude: pin.la, longitude: pin.lo, title: pin.text, subtitle: pin.address, pincolor: Titanium.Map.ANNOTATION_GREEN, animate: false, rightButton: pinButton, image: pinImage })); } return _results; })(); // Finally I create a Map View, mapView = Ti.Map.createView({ mapType: Titanium.Map.STANDARD_TYPE, region: that.region, animate: true, regionFit: true, userLocation: true });Now if after "userLocation" (or anywhere else in crateView for that matter) I add the Array of Annotation objects, like this:
mapView = Ti.Map.createView({ mapType: Titanium.Map.STANDARD_TYPE, region: that.region, animate: true, regionFit: true, userLocation: true, annotations: allPins });then I get an App "Force Quit" crash and this is what is in the log: http://pastebin.com/VnUxL1rX
Please Help.
1 Answer
This way you can determine if the break is in the creation of the annotation data or the adding of the annotation. Do you have an idea of how many annotation you care trying to create? Also consider using a try catch to track down the problem.
try { //your loop } catch(e) { alert(e.message); }
Your Answer
Think you can help? Login to answer this question!