Exception:Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:…] prior to use

前端 未结 10 1930
挽巷
挽巷 2021-01-04 12:44

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         


        
10条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-04 13:34

    You are skipping provideAPIKey in your AppDelegate check project

    Your_PROJECT -> ios -> Runner -> AppDelegate.m

    Replace your file code with below snippet add your APIKEY

    #include "AppDelegate.h"
    #include "GeneratedPluginRegistrant.h"
    #import "GoogleMaps/GoogleMaps.h"
    
    @implementation AppDelegate
    
    - (BOOL)application:(UIApplication *)application
        didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      [GMSServices provideAPIKey:@"GOOGLE_API_KEY"];
      [GeneratedPluginRegistrant registerWithRegistry:self];
      return [super application:application didFinishLaunchingWithOptions:launchOptions];
    }
    @end
    

    Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...]

提交回复
热议问题