KhanShaheb
KhanShaheb

Reputation: 714

Why IOS app is crashing while using Google Places API?

According to Google Doc here I tried whatever they said to do but all my efforts are in vain due to this error. But I didn't any change in info.plist.

2016-10-08 16:55:36.045 ContactApp[2674:83727] *** Terminating app due to uncaught exception 'GMSPlacesException', reason: 'Google Places API for iOS must be initialized via [GMSPlacesClient provideAPIKey:...] prior to use'

In my AppDelegate.swift I did look like below

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
    }

}

and I simply copied code and pasted to my controller. Here is also a link of my controller here

what can I do? Please provide any suggestion.

Upvotes: 1

Views: 1759

Answers (1)

AndrewR
AndrewR

Reputation: 10889

Use

GMSPlacesClient.provideAPIKey("YOUR_API_KEY")

instead of

GMSServices.provideAPIKey("**********************")

Upvotes: 5

Related Questions