Search code examples
iosgoogle-maps-sdk-iosswift3

Using Google Maps SDK with Swift 3


Has anyone tried Google Maps SDK for iOS with Swift 3. I was messing around with a dummy project and I keep getting the following error.

Seems like it can't authenticate with the API key. Any workarounds?

2016-06-20 23:36:37.386089 Cartographer[2225:585571] [DYMTLInitPlatform] platform initialization successful
2016-06-20 23:36:37.688701 Cartographer[2225:585341] *** Terminating app due to uncaught exception 'GMSServicesException', reason: 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use'
*** First throw call stack:
(0x1b960bb9 0x1b07ef73 0x1b960aff 0xeca37 0xea215 0xde55b 0xddd15 0xddbad 0xd4770 0xd4ec8 0xd50f4 0x20dd37b1 0x20f04197 0x20f03e3f 0x20dd34c9 0x20f04197 0x20f040ed 0x20f03e3f 0x20dd29d9 0x2104b7ad 0x2104b90f 0x20b90535 0x2097da71 0x20b8f233 0x20ba19ff 0x20b8c7c5 0x1d18915b 0x1d189015 0x1d1892ff 0x1b91efe3 0x1b91eaed 0x1b91cdc3 0x1b8705ed 0x1b870479 0x209775cb 0x20971ca1 0xdad98 0x1b4f255f)
libc++abi.dylib: terminating with uncaught exception of type NSException

Solution

  • I found the problem. The issue was related with me using the shorthand argument names used to configure a constant, in my case my map view.

    Therefore the initialisation was being problematic.