Firebase 身份验证注销错误 - Swift

Firebase Auth Signout Error - Swift

当我尝试使用此方法注销用户时,出现错误:

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()
}

我在网上找不到任何解决此错误的信息。有人知道问题出在哪里吗?

您需要启用钥匙串共享权限。

在项目导航器中,转到您的项目设置并找到您的目标。在“功能”选项卡下,开启“钥匙串共享”。

我在尝试创建新用户时遇到了同样的问题。我不确定为什么 Firebase 现在需要此权限,但它有效。