ios - 为什么 IOS 应用程序在使用 Google Places API 时崩溃?

标签 ios swift2 google-places-api

根据谷歌文档 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/

相关文章:

iphone - 如何缩放 iOS 绘图应用程序?

ios - 我无法在后台播放音乐(Xcode 9、Swift 4)

swift - 变量在其自己的初始值内使用,而变量在 init 之后的闭包内使用

ios - Google Places Api 每日限额问题

ios - GMSAutocompleteResultsViewController 显示有限的结果?

iphone - 如何在不缩放 iPhone subview 的情况下缩放图像?

swift - 在 Swift 中,为什么子类方法不能覆盖父类(super class)中协议(protocol)扩展提供的方法

Swift 2 for循环低日期和高日期之间

mysql - 不同数据库设计的性能(Google Places API)

ios - UIBezierPath 中的 CGContextSaveGState 0x0