genghiskhan genghiskhan - 19 days ago 9
iOS Question

Firebase Anonymous Login fails after Xcode Update

My anonymous login for Firebase was working for months; however, when Xcode forced me to install some updates, it couldn't find some pods. After deleting those pods after running pod update, the project will now build; however, while attempting the anonymous login, I get this error:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)


If I wait long enough, I get error messages like this:

[Client] Discarding message for event <private> because of too many unprocessed messages


Here is my login method:

func login(onCompletion: @escaping (NSError?) -> Void) {
print("authenticating user")
FIRAuth.auth()?.signInAnonymously(completion: { result, error in
guard error == nil else {
print("error while authenticating user")
onCompletion(loginError)
return
}

if let user = result {
self.defaults.set(user.uid, forKey: "uid")
onCompletion(nil)
} else {
onCompletion(loginError)
}
})
}


which is called in the root view controller's viewDidLoad.

Answer

I still don't know what the issue was, but it was specific to the project. I created a new project and pulled the code from github and now it works like normal.