When I try to sign out the user using this method, I just get an error:
fatal error: 'try!' expression unexpectedly raised an error: Error Domain=FIRAuthErrorDomain Code=17995 "An error occurred while accessing the keychain." UserInfo={NSLocalizedDescription=An error occurred while accessing the keychain., error_name=ERROR_KEYCHAIN_ERROR, NSLocalizedFailureReason=SecItemDelete (-34018)}: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-800.0.33.1/src/swift/stdlib/public/core/ErrorType.swift, line 146
func logout() {
try! FIRAuth.auth()!.signOut()
}
I didn't find anything on the web addressing this error.. does anyone know what could be the problem?
You need to enable the Keychain Sharing entitlement.
From the Project Navigator, go to your project settings and find your target. Under the Capabilities tab, turn on Keychain Sharing.
I had the same problem trying to create a new user. I'm not sure exactly why Firebase needs this permission now, but it works.