Currently, I am developing an application using Google Maps that utilizes both the Ionic Native Google Maps API and the JavaScript version. The Native API is implemented on a page called home.ts
, while the JavaScript API is utilized on a sub-page called details.ts
that can be accessed by tapping on the infoWindow of a marker.
Interestingly, the setup seems to be working well for me so far. However, it seems that I need to import "GoogleMaps" from @ionic-native/google-maps
into both details.ts
and home.ts
in order for the map images to load properly on the main page, while the markers and other functionalities work fine without any issues.
Unfortunately, the reason I need to use both APIs is that Ionic Native does not currently support the Google Places API. This has led to a potential problem that I have encountered -
On iOS devices, the app has a sporadic tendency to crash or freeze during transition events, such as switching between pages (the common trigger) or simply panning around the map generated by details.ts
. When this crash occurs, the error message displayed in XCode resembles the following:
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[2]
It seems that the number in objects[2] can vary in each occurrence.
Although I have not observed this issue in the Android version of the app yet, I have a suspicion that it may be present. I have discussed this with someone who believes that the app might occasionally try to access the wrong API. However, I am seeking further insights and potential complications that could arise from such a setup.