Zhou Haibo
Zhou Haibo

Reputation: 2068

Integrate Google drive into my app: Value of type 'GIDAuthentication' has no member 'fetcherAuthorizer'

I try to integrate google drive into my app to list mp3, m4a music files. Now I have made Google sign working, means I could signIn and signOut google account.

But when I follow google's api doc to this step Make an API call with fresh tokens, I got above error on line let authorizer = authentication.fetcherAuthorizer(). This function fetcherAuthorizer is not found.

I think maybe this doc is not up to date with latest google sdk. So I did a few search on Google...then it appears there is really rare stuff about this topic. What I found is all used this same code authentication.fetcherAuthorizer().

Thus, guys. Is there any update about this code?

user.authentication.do { authentication, error in
    guard error == nil else { return }
    guard let authentication = authentication else { return }

    // Get the access token to attach it to a REST or gRPC request.
    let accessToken = authentication.accessToken

    // Or, get an object that conforms to GTMFetcherAuthorizationProtocol for
    // use with GTMAppAuth and the Google APIs client library.
    let authorizer = authentication.fetcherAuthorizer()
}

Upvotes: 1

Views: 189

Answers (1)

Zhou Haibo
Zhou Haibo

Reputation: 2068

Today, I find the answer in this thread googlesignin-ios

The reason is Swift cannot find the fetcherAuthorizer from Objective-C library, we must manually import it import GTMSessionFetcher.

Upvotes: 1

Related Questions