Keychain Access Groups in entitlements for multi target iOS apps
Asked Answered
D

1

8

I have an iOS application project with 2 separate targets. For example target A and target B. Now in xCode8 when I turned keychain sharing to ON the Xcode generates two A.entitlements and B.entitlements files. Unexpectedly both of them have the same value like this:

<plist version="1.0">
<dict>
    <key>keychain-access-groups</key>
    <array>
        <string>$(AppIdentifierPrefix)target1.bundle.identifier</string>
    </array>
</dict>
</plist>

I mean in both of the file uses bundle identifier of my first target; and When I manually try to change the value for one of them the other one changes too.

As you know the Xcode will not sign the app while the value in keychain-access-groups exactly match the bundle identifier of the provisioning profile you use for sign.

So I am wondering how we can have two separate values for two separate entitlements files of two separate targets?

Drowsy answered 11/9, 2016 at 14:32 Comment(0)
D
15

I finally fixed this by using below code in my entitlements:

<plist version="1.0">
<dict>
    <key>keychain-access-groups</key>
    <array>
        <string>$(AppIdentifierPrefix)$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    </array>
</dict>
</plist>
Drowsy answered 11/9, 2016 at 15:7 Comment(2)
Thanks Husein jaan for an elegant fix, you saved a lot of time of mine.Percussion
Yeah! You saved my time and made my day! Thank you for the useful information.Radiometer

© 2022 - 2024 — McMap. All rights reserved.