Search code examples
iosgoogle-mapsswiftgoogle-maps-sdk-iosxcode6

Cannot access Google Map Framework in Swift AppDelegate file


I'm studying Swift and am struggling to figure out how to integrate the Google Map SDK frameworks. I created a new project in Xcode 6, imported the frameworks required as per Google Map SDK instructions for iOS.

However when I import the Google Maps framework using (import )to the AppDelegate.swift file the framework isn't recognised.

Can't find a solution anywhere. Please help.


Solution

  • After you imported Google Maps iOS SDK, you need to have a bridge header defined, then the SDK will be recognized.

    To create this bridge header, add an arbitrary Objective-C file(eg: a .m file) to your project. Xcode will prompt to ask you if to configure a bridge header for you.

    Click Yes to continue.

    A file ending with -Bridging-Header.h will be added to your project.

    Simply add #import <GoogleMaps/GoogleMaps.h> in the bridge header, and you are good to go!

    Also, it's safe to delete that temporary Objective-C file now.