pri pri - 1 year ago 111
iOS Question

Adding API key to an application

I am currently working on GoogleMaps APIs and am following this link .I have successfully completed the 4th step and now am facing problem in the next step where i have to import GoogleMaps in App Delegate's .m file. But i m unable to do so. Can anyone tell me why??

enter image description here

Answer Source

you are in the correct way , just add the following code

@import GoogleMaps; in your header file or use like #import <GoogleMaps/GoogleMaps.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
// Override point for customization after application launch.
[GMSServices provideAPIKey:@"xxxxxxx"];
[self.window makeKeyAndVisible];
return YES;

While you should be able to start using the Google Maps SDK at this stage, there is one more step you need to take because of a bug in Cocoapods. In the Project Navigator, select the yourPRojectName project at the top. Choose the yourPRojectName target, select the Build Settings tab, and in Other Linker Flags add -ObjC as shown below:

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download