Crush app with Google Maps v2 when you re-enter the page on iOS
I'm submitting a ... [ ] question [x] any problem or bug report [ ] feature request
plugin version: (check one with "x") [ ] 1.4.x [x] 2.0.0-beta2
cordova information: (run $> cordova plugin list)
com.googlemaps.ios 2.3.0 "Google Maps SDK for iOS"
cordova-android-play-services-gradle-release 0.0.2 "cordova-android-play-services-gradle-release"
cordova-plugin-app-event 1.2.0 "Application Events"
cordova-plugin-battery-status 1.2.4 "Battery"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 2.0.0-beta2-20170719-2226 "cordova-plugin-googlemaps"
cordova-plugin-mauron85-background-geolocation 2.2.5 "CDVBackgroundGeolocation"
cordova-plugin-network-information 1.3.3 "Network Information"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-plugin-x-socialsharing 5.1.8 "SocialSharing"
de.appplant.cordova.plugin.local-notification 0.8.5 "LocalNotification"
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
Current behavior: This happens only if an element is affixed to the map, for example, a marker. Without a marker, there is no error.
Previously, everything worked fine. The android works without problems.
Nobody faced such a problem? Any help will be appreciated. Thanks.
Expected behavior: App builds successfully.
Related code, data or error log (please format your code or data):
import { Component } from '@angular/core';
import { GoogleMaps, GoogleMap, GoogleMapsEvent, GoogleMapsMapTypeId, LatLng, MarkerOptions } from '@ionic-native/google-maps';
@Component({
selector: 'page-map-route',
templateUrl: 'map-route.html',
})
export class MapRoutePage {
public map: GoogleMap;
mapDiv: HTMLElement;
marker: MarkerOptions
constructor(
private googleMaps: GoogleMaps
) { }
ionViewDidLoad() {
this.loadMap();
}
loadMap() {
this.mapDiv = document.getElementById('map');
let map_location: LatLng = new LatLng(43.2566700, 76.9286100);
let mapOptions = {
mapType: GoogleMapsMapTypeId.NORMAL,
controls: {
compass: false,
myLocationButton: true,
indoorPicker: false,
zoom: false
},
gestures: {
scroll: true,
tilt: true,
zoom: true,
rotate: true
},
styles: [],
camera: {
latLng: map_location,
tilt: 0,
zoom: 1,
bearing: 0
},
preferences: {
zoom: {
minZoom: 0,
maxZoom: 18
},
building: true
}
};
this.map = this.googleMaps.create(this.mapDiv, mapOptions);
this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
alert('ready');
this.marker = {
position: map_location,
title: 'Test marker',
styles : {
'font-weight': 'bold',
'color': '#336600'
},
icon: {
'url': 'http://bvr.astanalux.kz/assets/images/start_point.png'
}
};
this.map.addMarker(this.marker);
});
}
}
cordova-plugin-googlemaps 2.0.0-beta2-20170719-2226 "cordova-plugin-googlemaps" is old. Please try the latest version (just reinstall the plugin)
App build in Ionic Package cloud. In package.json:
"dependencies": {
"@ionic-native/google-maps": "^4.0.1",
"cordova-plugin-googlemaps": "https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps",
"cordova-plugin-googlemaps-sdk": "https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git",
"com.googlemaps.ios": "https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk"
},
"cordova": {
"plugins": {
"com.googlemaps.ios": {},
"cordova-plugin-googlemaps": {
"API_KEY_FOR_ANDROID": "...",
"API_KEY_FOR_IOS": "...",
"LOCATION_WHEN_IN_USE_DESCRIPTION": "...",
"LOCATION_ALWAYS_USAGE_DESCRIPTION": "..."
}
}
}
config.xml:
<plugin name="com.googlemaps.ios" spec="https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk" />
<plugin name="cordova-plugin-googlemaps" spec="https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps">
<variable name="API_KEY_FOR_ANDROID" value="..." />
<variable name="API_KEY_FOR_IOS" value="..." />
<variable name="LOCATION_WHEN_IN_USE_DESCRIPTION" value="..." />
<variable name="LOCATION_ALWAYS_USAGE_DESCRIPTION" value="..." />
</plugin>
Build of 2017/08/01 - works. Then I paused. Build of 2017/08/15 (with the same code) - does not work.

I'm sorry, but i'm not the ionic user. I could not understand what your point is.
Hi
Think i have the same problem, issue with the marker the second time you load the page:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageCache removeAllCachedImages]: unrecognized selector sent to instance 0x170622480'
cordova-plugin-googlemaps 2.0.0-beta3-20170816-1600 "cordova-plugin-googlemaps"
Thanks
Thank you @derasmus I fixed it. Please reinstall the plugin and try again.
Thank you @derasmus , thank you @wf9a5m75 Everything works fine!
Thank you, had the same issue. We appreciate your swift bug fixing.
@wf9a5m75 Thank you for the quick & awesome support :)