Cannot build Google Maps on iOS after update to v3

I’ve been stuck for some time now with the Google Maps plugin for Ionic. Until now, it worked perfectly fine on Android and iOS, but since I updated my app from Ionic 2 to 3 I cannot build it for iOS.

I’ve tried removing all npm modules and all plugins and platforms and reinstalling them again, I’ve been looking and googling for a solution for hours now and I’m starting to desperate. In android I have no problem building or running the app.

I’m building the app using xcode (opening the workspace’s file, not the project’s), but there are always two related errors:

/.../platforms/ios/appname/Plugins/com.googlemaps.ios/GoogleMaps.framework/Headers/GMSPolyline.h:11:9: 'UIKit/UIKIt.h' file not found
which causes the next error:

/.../platforms/ios/appname/Plugins/cordova-plugin-googlemaps/GoogleMaps.h:10:9: Could not build module 'GoogleMaps'

So the problem basically consists on UIKit library not being found.
This is the maps plugin tag at config.xml:

<plugin name="cordova-plugin-googlemaps" spec="~1.4.0">
    <variable name="API_KEY_FOR_ANDROID" value="myapikeyforandroid" />
    <variable name="API_KEY_FOR_IOS" value="myapikeyforios" />
    <variable name="NSLOCATIONWHENINUSEUSAGEDESCRIPTION" value="Show your location on the map" />
    <variable name="NSLOCATIONALWAYSUSAGEDESCRIPTION" value="Trace your location on the map" />
</plugin>

In the package.json I have these dependences:


"dependencies": {
    "@angular/common": "4.1.2",
    "@angular/compiler": "4.1.2",
    "@angular/compiler-cli": "4.1.2",
    "@angular/core": "4.1.2",
    "@angular/forms": "4.1.2",
    "@angular/http": "4.1.2",
    "@angular/platform-browser": "4.1.2",
    "@angular/platform-browser-dynamic": "4.1.2",
    "@ionic-native/background-geolocation": "^3.12.1",
    "@ionic-native/background-mode": "^3.12.1",
    "@ionic-native/barcode-scanner": "^3.12.1",
    "@ionic-native/core": "3.11.0",
    "@ionic-native/geolocation": "^3.12.1",
    "@ionic-native/google-maps": "^3.12.1",
    "@ionic-native/local-notifications": "^3.12.1",
    "@ionic-native/push": "^3.12.1",
    "@ionic-native/secure-storage": "^3.12.1",
    "@ionic-native/social-sharing": "^3.12.1",
    "@ionic-native/splash-screen": "^3.12.1",
    "@ionic-native/status-bar": "^3.11.0",
    "@ionic-native/streaming-media": "^3.12.1",
    "@ionic-native/video-player": "^3.12.1",
    "@ionic/storage": "2.0.1",
    "angular2-jwt": "^0.2.3",
    "ionic-angular": "3.3.0",
    "ionicons": "3.0.0",
    "rxjs": "5.1.1",
    "socket.io-client": "^1.7.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.11"
  }

I’m building this using XCode 8.3.
These are the solutions I already tried:

  • The UIKit Library is included in the project, I tried readding it from XCode at the Build Phases tab but it didn’t have any effect.
  • I’m building using the workspace file
  • Reinstalling XCode didn’t solve the issue.
  • I’ve tried with 1.3.0 but it didn’t help.
  • I’ve also tried removing and adding the iOS platform
  • I’ve tried cleaning the project before building it again, after and before reinstalling XCode.
  • Building with ionic cordova build ios or ionic cordova run ios gives the same result.
  • Uninstalling the google maps plugins solves the building error, but I really need to have this plugin.

Thanks in advance for the help.

EDIT: I’ve tried adding to the Framework Search Paths and the System Framework Search Paths the location of the UIKit framework, but it doesn’t work: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/UIKit.framework/

Well, after trying all kind of solutions I could made up, I arrived to the simplest conclusion: the UIKit.h import wasn’t needed. So I just removed from the files GMSTileLayer.h and GMSPolyline.h of the directory platform/ios/AppName/Plugins/com.googlemaps.ios/GoogleMaps.framework/Headers the line #import <UIKit/UIKIt.h> and now it works just fine. I wonder why this didn’t give any errors before the version change, because the googlemaps plugin version has been always the same.