将 Google Maps SDK 与 Swift 一起使用 3

Using Google Maps SDK with Swift 3

有没有人尝试过 Google Maps SDK for iOS with Swift 3. 我正在处理一个虚拟项目,我不断收到以下错误。

似乎无法使用 API 密钥进行身份验证。有什么解决方法吗?

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

我发现了问题。这个问题与我使用 shorthand argument names 用于配置常量有关,在我的例子中是我的地图视图。

因此初始化有问题。