使用未解析的标识符“OAuthProvider”

Posted

技术标签:

【中文标题】使用未解析的标识符“OAuthProvider”【英文标题】:Use of unresolved identifier 'OAuthProvider' 【发布时间】:2019-12-27 10:31:08 【问题描述】:

https://firebase.google.com/docs/auth/ios/apple

我在 firebase apple login 中遵循指南,但我收到错误“,即使我已包含 Firebase。


extension SignInWithAppleDelegates: ASAuthorizationControllerDelegate 
  func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) 
    switch authorization.credential 
    case let appleIdCredential as ASAuthorizationAppleIDCredential:
      if let _ = appleIdCredential.email, let _ = appleIdCredential.fullName 
        displayLog(credential: appleIdCredential)
      
      signInSucceeded(true)

    default:
      break
    


    // Initialize a Firebase credential.
    let credential = OAuthProvider.credential(withProviderID: "apple.com",
                                              idToken: idTokenString,
                                              rawNonce: nonce)
    // Sign in with Firebase.
    Auth.auth().signIn(with: credential)  authResult, error in
      if error 
        // Error. If error.code == .MissingOrInvalidNonce, make sure
        // you're sending the SHA256-hashed nonce as a hex string with
        // your request to Apple.
        print(error.localizedDescription)
        return
      
      // User is signed in to Firebase with Apple.
      // ...
    
  

pod 'Firebase' 是我安装 firebase 模块的方式。

【问题讨论】:

【参考方案1】:

pod 'Firebase/Auth' 是解决方案。在快速文件中,您必须 import FirebaseAuth

【讨论】:

以上是关于使用未解析的标识符“OAuthProvider”的主要内容,如果未能解决你的问题,请参考以下文章

使用未解析的标识符 FBSession

使用未解析的标识符 'json' (Swift 3) (Alamofire)

使用未声明的类型“DKAsset”,使用未解析的标识符“DKImagePickerController”?

出现错误:使用未解析的标识符“LinkingObjects”

使用未解析的标识符 countElements [重复]

SDKApplicationDelegate 使用未解析的标识符