简体   繁体   中英

Firebase Auth Signout Error - Swift

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM