Search code examples
iosfirebasefirebase-authenticationios13xcode11

Xcode 11 Firebase auth for Mac app has error An error occurred when accessing the keychain


I am turning iOS app to Mac app, when I run Xcode for My Mac, I was trying to login my app on Mac, when I press button login, below Error shows:

An error occurred when accessing the keychain. The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo dictionary will contain more information about the error encountered

MacOS: 10.15.1 Xcode: 11.2.1

It works totally fine on iPhone simulator or real iPhone, it only occurs when I try to run on Mac

I think this is a issue that Firebase does Auth does not really support Mac app that well.

PS: there is a question looks kind similar, but I don't really understand Firebase fails to configure and load the user on some devices running iOS 10


Solution

  • Add Keychain Sharing Capability to the target's build settings. More context here.

    Click the + Capability and then choose Keychain Sharing Capability

    enter image description here