Question Detail

I am tring to integrate Flutter map from lib 

google_maps_flutter:

it is working fine and showing me map in emulator and real device but when i run project on IOs device it gives me below mentioned error

*** Terminating app due to uncaught exception 'GMSServicesException', reason: 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use'

How to resolve GMSServicesException?


Thread Reply

Hemant Sharma

- 5 months ago

I thing you are skipping provideAPIKey in your AppDelegate check your

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

Replace your file code with below snipits 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:...] work for me

Hemant Sharma

- 5 months ago

I thing you are skipping provideAPIKey in your AppDelegate check your

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

Replace your file code with below snipits 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:...] work for me