[Google Maps Plugin] iOS Map only will load once

[Google Maps Plugin] iOS Map only will load once

  
Forge Component
(4)
Published on 2017-08-04 by Grazina
4 votes
Published on 2017-08-04 by Grazina

Hoping to use this plugin in an app we are currently developing.  Everything seems to work fine in Android, but in iOS the map will only load the first time I visit the page.  If I use the back button to go back to the previous view then try and open the map again only a white page is displayed the second time.

Hi Jason can you provide a sample oml with this  behavior?

Alexandre Costa wrote:

Hi Jason can you provide a sample oml with this  behavior?

Hi Alexandre here is a dropbox link to an oml let me know if you are not able to access it.

https://www.dropbox.com/s/ed189barqbj4o2e/MapTest.oml?dl=1

It doesnt use a back button but when using the bottom bar buttons to navigate back and forth between the two views the same thing happens.  Sometimes I will get lucky and the map view will load a second time but it is not consistant

Jason Dunfee wrote:

Alexandre Costa wrote:

Hi Jason can you provide a sample oml with this  behavior?

Hi Alexandre here is a dropbox link to an oml let me know if you are not able to access it.

https://www.dropbox.com/s/ed189barqbj4o2e/MapTest.oml?dl=1

It doesnt use a back button but when using the bottom bar buttons to navigate back and forth between the two views the same thing happens.  Sometimes I will get lucky and the map view will load a second time but it is not consistant


Hi Alexandre,  were you able to access the oml file and did you experience the same thing I am seeing? Any help you can provide would be greatly appreciated.  Thank you.

Solution

Jason Dunfee wrote:

Jason Dunfee wrote:

Alexandre Costa wrote:

Hi Jason can you provide a sample oml with this  behavior?

Hi Alexandre here is a dropbox link to an oml let me know if you are not able to access it.

https://www.dropbox.com/s/ed189barqbj4o2e/MapTest.oml?dl=1

It doesnt use a back button but when using the bottom bar buttons to navigate back and forth between the two views the same thing happens.  Sometimes I will get lucky and the map view will load a second time but it is not consistant


Hi Alexandre,  were you able to access the oml file and did you experience the same thing I am seeing? Any help you can provide would be greatly appreciated.  Thank you.


Found a solution.  there appears to be a timing issue between when the dom elements are available and when the plugin is trying to bind to the div.  If I put the initialization code that is in RegisterPlugin in a setTimeout function for a few seconds it appears to fix the problem.  I am not sure if there is something that can be done in the obj C portion of the plugin itself to make sure the div is present.  These couple of  issue logs in github pointed me in this direction.

https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1472

 https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/623

Solution