+2
Fixed

Map causing app to crash

doug 12 years ago updated by teddscofield 12 years ago 4
I am trying to use the map object to get the user's gps latitude and longitude to be able to submit it to FourSquare using their REST API. However when I open the app, it sometimes causes the app to crash. Probably out of 5 tries, it will happen 3 times. I'm assuming it has to be a memory issue, but I'm not certain.

Here is what I have for my code:



<datasources>
<datasource name="geo" source="standard" query="location" distanceFilter="1" providertype="location" />
</datasources>
<main>
<map name="map" alias="MAP" datasource="geo" xpos="350" width="50" height="50" type="satellite" showuser="yes" currentlocation="yes"></map>
</main>
<actions>
<action name="enter-amount">
<sync>
<assign property="datasource:geo.location" value="on"/>
<assign property="object:MAP.region" value="[object:MAP.gpslatitude] [object:MAP.gpslongitude] [object:MAP.gpslatitude] [object:MAP.gpslongitude]"/>
<assign property="var:latitude" value="[object:MAP.gpslatitude]" />
<assign property="var:longitude" value="[object:MAP.gpslongitude]" />
</sync>
<assign property="var:tipCalculated" value="" />
</action>
</actions>
Doug,

Thanks for bringing this to our attention. We are currently tracking a few memory issues with Apple Maps in iOS 6.
In this case, the location datasource is not needed to generate the gps location in your map tag.

Remove the datasource and its references and this should work fine without crashes.

The location datasource is used for objects outside of the map to trigger actions.
Ah, I can safely say that this was my first experimentation with the map so I wasn't quite sure. Looks like it is working pretty well now.
FWIW I had similar issues when loading pins during an oninit action. When I moved the loading of the pins to occur as a result of a user action instead of during the init phase stability improved quite a bit.