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 c
Good news! we switched over our apps framework from google to leaflet and it works beautifully, no crashing, we checked the debug and it runs extremely high memory but never crashes. If you have not already go with Leaflet, it fully works on iOS 7,
Heyy... I was also facing the similar problem. So, I tried this:
I cleared the application caches in "didReceiveMemoryWarning" method of my view controller and custom plugins and set the properties and variables to NIL in "onMemoryWarning" method of CDVPlugin class. And this approach did the work for me. I am not getting any crash as of now. Hope this helps.
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.
I had the same problem and tried out a few things. I disabled the animation when markers are set (I had about 30 being added at once) and it seems like it doesn't crash any more now. Hope that helps.
I believe IOS7 has a memory cap of 5Mb (longer battery life), it used to be 50Mb or something like that. Since the cap is limited with OS, so it does not matter if you are using Chrome, Safari or other browsers, it will crash if exceeded.
i tested my receiving data limit to 20 from SQL, and it works on all browsers on my iphone (pad).