2

I'm trying to integrate Google App Indexing into my iOS / Swift app. I installed it via CocoaPods. The problem is it's not resolving any of Google's code. Here's what I got:

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
    var sanitizedURL = GSDDeepLink.handleDeepLink(url)
    return true
}

The compile error says: Use of unresolved identifier 'GSDDeepLink'. I tried adding import GoogleAppIndexing and even import GSDDeepLink, but it says: no such module 'GoogleAppIndexing'. Any ideas or anyone got this to work with Swift?

TruMan1
  • 33,665
  • 59
  • 184
  • 335

1 Answers1

0

under supporting files, there should be a file that ends with "-Bridging-Header.h." You want to do the Objective-C import statement there:

#import <GoogleAppIndexing/GoogleAppIndexing.h>
Jed
  • 494
  • 1
  • 6
  • 15
  • I don't have a Bridging-Header file anywhere (I searched the whole workspace). I believe this is because CocoaPods is handling all this since I've never seen a bridging file for any Swift / CocoaPod project before. – TruMan1 Jul 20 '15 at 21:08
  • create an objective-c header file, and make sure that you designate its path in the "swift compiler - code generation" section of your build settings under the setting "objective-c bridging header." you probably also want to set "install objective-c compatibility header" to yes – Jed Jul 21 '15 at 17:30