0

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 form 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'

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"
  }

Let me know if I can provide any more clues...

Thanks in advance for the help.

EDIT: I've tried adding the UIKit Library and reinstalling XCode, but nothing works. If I remove the google maps plugin, the app builds just fine, so it seems to be related to cordova-plugin-googlemaps I'm trying now other versions to determine whether this is a version issue.

EDIT 2: Changing the google maps version didn't have any effects...

EDIT 3: I've found this thread, which seems similar to this one, but there wasn't any answer either.

Aruk
  • 33
  • 1
  • 5

3 Answers3

0

It sounds like your error may be similar to the one mentioned at this answer.

Try it and report back!

Simon Visser
  • 364
  • 3
  • 14
  • Thanks! I've tried adding the Library but when I went to Build Phases it was already added. The Framework Search Paths are fine too and I never change any of this configuration. I'll try reinstalling XCode as suggested in that answer for now. – Aruk Jun 07 '17 at 05:17
  • I've reinstalled XCode, remove and added the ios platform again and clicked in Product > Clean before compiling again, but the problem persists D: – Aruk Jun 07 '17 at 07:17
0

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.

Aruk
  • 33
  • 1
  • 5
0

I had the same problem, but I have found a solution. The problem is that there is a typo in the original file.

#import <UIKit/UIKIt.h> should be #import <UIKit/UIKit.h> (the second i in UIKit.h is now lower case)

After I fixed this in the GMUGradient.h file, the place where Xcode gave me the error, the build ran smoothly.