That is the code for Fb Login on my app. The app does not launch and throws Worth of kind ‘AuthErrorCode’ has no member ‘debugDescription’ error. Anybody is aware of how I can do away with this?
extension SignInViewController {
func facebookLogin() {
let loginManager = LoginManager()
loginManager.logIn(permissions: [.publicProfile, .email], viewController: self) { (loginResult) in
swap loginResult
{
case .cancelled:
self.current(UIAlertController.errorAlert(with: "Cancelled"), animated: true, completion: nil)
break
case .failed(let error):
print(error.localizedDescription)
self.current(UIAlertController.errorAlert(with: error.localizedDescription), animated: true, completion: nil)
break
case .success(let grantedPermission, let declinedPermission, let token):
print("the grandted permissions (grantedPermission)")
print("the declined permissions (declinedPermission)")
print("the token is (token)")
let credential = FacebookAuthProvider.credential(withAccessToken: token.tokenString)
MBProgressHUD.showAdded(to: self.view, animated: true)
// get Fb person info
self.getFacebookInfo({ (appUser) in
if let appUser = appUser {
// login Firebase with Fb
OAuthProvider.credential(withProviderID: "fb.com", idToken: token.tokenString, rawNonce:self.randomNonceString())
Auth.auth().signIn(with: credential) { (consequence, error) in
if let error = error {
MBProgressHUD.conceal(for: self.view, animated: true)
let castedError = error as NSError
let firebaseError = AuthErrorCode(AuthErrorCode.Code(rawValue: castedError.code) ?? <#default worth#>)
if firebaseError != nil {
print(firebaseError.debugDescription)
}
self.current(UIAlertController.errorAlert(with: "Signin was failed. n(error.localizedDescription)"), animated: true, completion: nil)
return
}
appUser.userId = consequence?.person.uid
self.signedInWithFacebook((consequence?.person)!, appUser: appUser)
MBProgressHUD.conceal(for: self.view, animated: true)
}
} else {
MBProgressHUD.conceal(for: self.view, animated: true)
self.current(UIAlertController.errorAlert(with: "Cancelled"), animated: true, completion: nil)
}
})
}
}
}
And the app does not construct due to the beneath error:
if firebaseError != nil {
print(firebaseError.debugDescription)
}
*Worth of kind ‘AuthErrorCode’ has no member ‘debugDescription’
*
Any assist with this may be a lot appreciated.