3

Setup 1:

I have a swift app with a single target that runs on both iOS and macOS - com.teamName.appName. I have an app group group.com.teamName.appNameand a keychain sharing group com.teamName.appName for it. When setting up the authentication, i use

try Auth.auth().useUserAccessGroup("group.com.teamName.appName")

I need this in order to stay signed in in my app extensions, like notifications or share extension.

Issue:

In this setup without doing anything else, the auth state on iOS persists but macOS requires re-authenticating each time because the above try statement throws Error Domain=FIRAuthErrorDomain Code=17995 "An error occurred when accessing the keychain.

Fix attempted:

Now, looking around online i found that providing the team id inside the group name would fix the issue. So basically going from group.com.teamName.appName to teamId.group.com.teamName.appName. This behaviour is already done under the hood for keychain groups. Setting the keychain group on the target as com.teamName.AppName will actually set it as $(AppIdentifierPrefix)com.teamName.AppName if you look in the entitlements.

Result:

MacOS compiles, runs fine and the authentication persists, but the iOS target no longer compiles with the following error: Application Group identifiers should start with 'group.' but only when trying to compile on a physical device

Looking for any guidance on what i am doing wrong and or what i can improve on to have both apps compile, run and persist their authentication state.

Thanks!

0 Answers0