Reputation: 69
I developed an application on Ionic 4 using GoogleMaps. I first developed on Android, then when I wanted to export my project to IOS, problems appeared.
I would like to point out that I use the cordova-plugin-googlemaps "multiple_maps" version on Android, and that without it, I hadn't managed to get the map to work on Android.
I installed the dependencies for my project :
But with this last command, problems appeared. I could see in the console that android and browser were well installed, ios also thanks to "pod". So I'm trying to build on Xcode: I have errors that the file "GoogleMaps/GoogleMaps.h" is not found.
The solution I found is to open the Podfile file, and change the version of GoogleMaps from "2.7.0" by default, to the version "3.1.0". So I deleted the Podfile.lock file and the Pods folder, and I restarted a pod install.
Unfortunately, I still have the error "GoogleMaps/GoogleMaps.h is not found. ", but I managed once (unfortunately I don't know how anymore) to remove this error and launch this application.
Instead of the map, I have the error "[GoogleMaps] cordova-plugin-googlemaps is not installed or ready yet." . I'm pretty sure the code behind it is ok, since it works without any problems on Android.
Here are my version details :
OS : Mojave 10.14.5 (last version) XCode : 10.2 (last version) cordova : 8.1.2 cordova-ios : 5.0.1 ionic : 5.0.1
My cordova plugin list :
cordova-clipboard 1.2.1 "Clipboard" cordova-plugin-camera 4.0.3 "Camera" cordova-plugin-device 2.0.2 "Device" cordova-plugin-file 6.0.1 "File" cordova-plugin-file-transfer 1.7.1 "File Transfer" cordova-plugin-filepath 1.5.1 "cordova-plugin-filepath" cordova-plugin-geolocation 4.0.1 "Geolocation" cordova-plugin-googlemaps 2.6.2 "cordova-plugin-googlemaps" cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard" cordova-plugin-ionic-webview 3.1.2 "cordova-plugin-ionic-webview" cordova-plugin-mauron85-background-geolocation 3.0.3 "CDVBackgroundGeolocation" cordova-plugin-network-information 2.0.1 "Network Information" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-whitelist 1.3.3 "Whitelist" info.protonet.imageresizer 0.1.1 "Image Resizer"
My package.json
"dependencies": {
"@angular/common": "^7.2.13",
"@angular/core": "^7.2.13",
"@angular/forms": "^7.2.13",
"@angular/http": "^7.2.13",
"@angular/platform-browser": "^7.2.13",
"@angular/platform-browser-dynamic": "^7.2.13",
"@angular/router": "^7.2.13",
"@ionic-native/splash-screen": "^5.4.0",
"@ionic-native/status-bar": "^5.4.0",
"@ionic/angular": "^4.3.0",
"@mauron85/cordova-plugin-background-geolocation": "3.0.3",
"cordova-android": "8.0.0",
"cordova-browser": "6.0.0",
"cordova-clipboard": "1.2.1",
"cordova-ios": "4.5.5",
"cordova-plugin-camera": "4.0.3",
"cordova-plugin-device": "2.0.2",
"cordova-plugin-file": "6.0.1",
"cordova-plugin-file-transfer": "1.7.1",
"cordova-plugin-filepath": "1.5.1",
"cordova-plugin-geolocation": "4.0.1",
"cordova-plugin-googlemaps": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^3.0.0",
"cordova-plugin-mauron85-background-geolocation": "^3.0.1",
"cordova-plugin-network-information": "2.0.1",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-statusbar": "2.4.2",
"cordova-plugin-whitelist": "1.3.3",
"cordova-windows": "4.4.2",
"core-js": "^2.5.4",
"info.protonet.imageresizer": "0.1.1",
"ionic-plugin-keyboard": "2.2.1",
"zone.js": "~0.8.29"
},
"devDependencies": {
"@angular-devkit/architect": "~0.12.3",
"@angular-devkit/build-angular": "^0.13.8",
"@angular-devkit/core": "~7.2.3",
"@angular-devkit/schematics": "~7.2.3",
"@angular/cli": "^7.3.8",
"@angular/compiler": "^7.2.13",
"@angular/compiler-cli": "^7.2.13",
"@angular/language-service": "^7.2.13",
"@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-free": "^5.8.1",
"@fortawesome/fontawesome-svg-core": "^1.2.17",
"@fortawesome/free-brands-svg-icons": "^5.8.1",
"@fortawesome/free-regular-svg-icons": "^5.8.1",
"@fortawesome/free-solid-svg-icons": "^5.8.1",
"@ionic-native/background-geolocation": "^5.4.0",
"@ionic-native/camera": "^5.5.1",
"@ionic-native/clipboard": "^5.4.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/file": "^5.5.1",
"@ionic-native/file-path": "^5.5.1",
"@ionic-native/geolocation": "^5.4.0",
"@ionic-native/google-maps": "^5.0.0-beta.27",
"@ionic-native/image-resizer": "^5.5.1",
"@ionic-native/keyboard": "^5.4.0",
"@ionic-native/network": "^5.6.0",
"@ionic-native/transfer": "^3.14.0",
"@ionic/angular-toolkit": "~1.4.0",
"@ionic/app-scripts": "^3.2.3",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~10.14.2",
"codelyzer": "~4.5.0",
"cordova": "^8.1.2",
"ionic4-rating": "^1.0.9",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.4",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.12.0",
"protractor": "~5.4.0",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.4.0",
"ts-node": "~8.0.0",
"tslint": "~5.12.0",
"typescript": "~3.1.6"
},
"description": "Test",
"cordova": {
"platforms": [
"windows",
"browser"
],
"plugins": {
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": ""
},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-clipboard": {},
"cordova-plugin-mauron85-background-geolocation": {
"GOOGLE_PLAY_SERVICES_VERSION": "11+",
"ANDROID_SUPPORT_LIBRARY_VERSION": "26+",
"ICON": "@mipmap/icon",
"SMALL_ICON": "@mipmap/icon",
"ACCOUNT_NAME": "@string/app_name",
"ACCOUNT_LABEL": "@string/app_name",
"ACCOUNT_TYPE": "$PACKAGE_NAME.account",
"CONTENT_AUTHORITY": "$PACKAGE_NAME"
},
"cordova-plugin-camera": {},
"cordova-plugin-file": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-filepath": {},
"info.protonet.imageresizer": {},
"cordova-plugin-network-information": {},
"cordova-plugin-googlemaps": {
"API_KEY_FOR_ANDROID": "My_Key",
"API_KEY_FOR_IOS": "My_Key",
"LOCATION_WHEN_IN_USE_DESCRIPTION": "This app wants to get your location while this app runs only.",
"LOCATION_ALWAYS_USAGE_DESCRIPTION": "This app wants to get your location always, even this app runs in background."
}
}
}
Edit : I created a minimal project to reproduce the problem https://github.com/NuritArmelle/Bug-googlemaps-not-installed
Here are the steps I did to reproduce (on a Mac):
npm install
npm rebuild node-sass --unsafe-perm
ionic cordova platform add ios
ionic cordova prepare ios
npm install @ionic-native/core@beta
npm install @ionic-native/google-maps@beta
ionic cordova plugin add cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="my android key" --variable API_KEY_FOR_IOS="my IOS key"
At this point, when I tried to build, it already gave me the error: "GoogleMaps/GoogleMaps.h is not found." (and I was on xcworkspace this time).
Then I created my Podfile in platforms/ios (here are the contents of it):
DO NOT MODIFY -- auto-generated by Apache Cordova
platform :ios, '8.0'
target 'Bug-Googlemaps-not-installed' do
project 'Bug-Googlemaps-not-installed.xcodeproj'
pod 'GoogleMaps', '~> 2.7.0'
end
Finally, I did a "pod install". Still the same problem, can't build cause of "GoogleMaps.h".
Upvotes: 4
Views: 4308
Reputation: 61
I resolve in this way, follow changes I made:
sudo npm uninstall -g cordova
sudo npm install -g cordova
ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git
ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_IOS="your_api_key"
ionic cordova platform add ios.
ionic cordova prepare ios.
ionic cordova debug ios.
open xcode.
Upvotes: 3