Issue with entitlements in iOS when using firebase

Viewed 809

I'm building my app using Firebase. When I test on emulators everything is fine. But when I try to test on a device I get the following error:

Showing Recent Messages
Automatic signing is unable to resolve an issue with the "xxx" target's entitlements. Automatic signing can't add the com.apple.keystore.device and com.apple.keystore.access-keychain-keys entitlements to your provisioning profile. Switch to manual signing and resolve the issue by downloading a matching provisioning profile from the developer website. Alternatively, to continue using automatic signing, remove these entitlements from your entitlements file and their associated functionality from your code. (in target 'xxx')

Provisioning profile "iOS Team Provisioning Profile: com.xxx.xx" doesn't include the com.apple.keystore.access-keychain-keys and com.apple.keystore.device entitlements. (in target 'xxx')

As I saw on firebase documentation I added the following file with the entitlements I need:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.keystore.access-keychain-keys</key>
    <true/>
    <key>com.apple.keystore.device</key>
    <true/>
</dict>
</plist>

And below you can see how I set up my App in in Apple Developer Portal (I also try with Protected Unless Open)

enter image description here

Here is my Keychain Sharing enter image description here

And here the Data Protection enter image description here

So I guess I'm missing to set up the keychain sharing in developer portal, but I'm not sure how... I checked all the options and google this, but I cannot find a solution. I want to check if it possible to keep the automatic signin or if I have to do that manually

2 Answers

Seems to me the syntax for how keychains are dealt with by Apple has changed. Maybe an Xcode upgrade or something.

Remove this:

    <key>com.apple.keystore.access-keychain-keys</key>
    <true/>
    <key>com.apple.keystore.device</key>
    <true/>

And add this:

    <key>com.apple.security.application-groups</key>
    <array>
        <string>group.com.Yours.app</string>
    </array>
    <key>keychain-access-groups</key>
    <array>
        <string>$(AppIdentifierPrefix)group.com.Yours.app</string>
        <string>$(AppIdentifierPrefix)com.Yours.app</string>
    </array>

Then set up Groups in your Apple Developer provisioning setup instead.

I had the same problem and solved it by removing those keys and values from the entitlements file.

nativescript-plugin-firebase documentation says that they are needed if you face a problem in the iOS simulator. You can remove them.

Related