例外情况:使用前必须通过[GMSServices providesAPIKey:...]初始化Google Maps SDK for iOS [英] Exception:Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use

查看:579
本文介绍了例外情况:使用前必须通过[GMSServices providesAPIKey:...]初始化Google Maps SDK for iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Swift 2.0将Google Maps SDK实施到我的项目中。我遵循这一点,但在运行时,我的应用程序出现以下错误:

I am trying to implement Google Maps SDK into my project using Swift 2.0. I follow this but when running this, my app is getting the following error:

2015-08-25 19:05:17.337 googleMap[1919:54102] *** 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:
(
    0   CoreFoundation    0x00000001058499b5 __exceptionPreprocess + 165
...
...
...
    31  UIKit             0x000000010606699e UIApplicationMain + 171
    32  googleMap         0x00000001034b720d main + 109
    33  libdyld.dylib     0x0000000107fba92d start + 1
    34  ???               0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

我已经尝试了所有可能的解决方案从StackOverflow。

I have tried all possible solutions from StackOverflow.

推荐答案

您需要在didFinishLaunchingW ithOptions

You need to set this both in didFinishLaunchingWithOptions

GMSPlacesClient.provideAPIKey("Your key")
GMSServices.provideAPIKey("Your key")

这篇关于例外情况:使用前必须通过[GMSServices providesAPIKey:...]初始化Google Maps SDK for iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆