Google App Indexing not resolving for Swift?

2019-07-14 06:57发布

问题:

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?

回答1:

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>