Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Map crashes in IOS7

We are developing an Hybrid app and we are using google map API in our application. When we are trying to load 2000 data markers in the map, it got crashed. Map is not get crashed in IOS6, IOS5. It is happening only in IOS7. Is there any memory related change done for ios7 application.

like image 867
user2771801 Avatar asked Sep 12 '13 08:09

user2771801


People also ask

Why does my Google map keep crashing?

Clear the app's cache & data On your Android phone or tablet, open the Settings app . Tap Apps & notifications. Follow the steps on your device to find the Maps app. After you select the app, storage & cache options should be available.

Why is Google Maps not working on iOS?

Make sure Location Services is on, and make sure Maps is set to While Using the App or Widgets. Set the date, time, and time zone correctly on your device. In the Settings app, tap General, then tap Date & Time. If possible, turn on Set Automatically.

Is there any problem in Google Maps today?

Maps.google.com is UP and reachable by us.


1 Answers

As said previously iOS7 is more strict with memory usage. This behavior occurs in other browsers like Chrome, so when an app reach upper limit in memory usage, the crash appears.

I have isolated two test cases using only Gmaps javascript API and jQuery:

Testing with 100 markers: Everything it's ok

http://jsfiddle.net/edfFq/6/embedded/result

Testing with 3000 markers: Crash occurs

http://jsfiddle.net/edfFq/7/embedded/result/

$(document).ready(function () {     var map;     var centerPosition = new google.maps.LatLng(40.747688, -74.004142);       var options = {         zoom: 2,         center: centerPosition,         mapTypeId: google.maps.MapTypeId.ROADMAP     };     map = new google.maps.Map($('#map')[0], options);       for (var i=0;i<2800;i++){               var position = new google.maps.LatLng(40*Math.random(),-74*Math.random());       var marker = new google.maps.Marker({             position: position,             map: map                    });     } }); 

You can get the crash with a less number of markers if your map uses: labels, custom icons and clusters.

like image 115
nachoorme Avatar answered Oct 06 '22 20:10

nachoorme