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

时间:2019-12-27 10:31:08

标签: swift

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

我正在遵循Firebase苹果登录指南,即使我包含Firebase,也收到错误消息“使用未解决的标识符'OAuthProvider'。


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 个答案:

答案 0 :(得分:0)

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