根据谷歌文档 here我尝试了他们所说的一切,但由于这个错误,我所有的努力都是徒劳的。但我在 info.plist 中没有任何变化。
2016-10-08 16:55:36.045 ContactApp[2674:83727] *** 由于未捕获的异常“GMSPlacesException”而终止应用程序,原因:“iOS 的 Google Places API 必须通过 [GMSPlacesClient provideAPIKey:...] 进行初始化使用'
在我的 AppDelegate.swift 中,我确实看起来像下面
import UIKit
import GoogleMaps
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
GMSServices.provideAPIKey("**********************")
return true
}
}
我只是复制代码并粘贴到我的 Controller 。这里也是我的 Controller 的链接here
我能做些什么?请提供任何建议。
最佳答案
采用
GMSPlacesClient.provideAPIKey("YOUR_API_KEY")
代替
GMSServices.provideAPIKey("**********************")
关于ios - 为什么 IOS 应用程序在使用 Google Places API 时崩溃?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39931696/