![](/img/trans.png)
[英]Is there a way to list keychain access groups in an iOS app at runtime?
[英]Keychain Access Groups in entitlments for multi target ios apps
我有一個iOS應用程序項目,有2個獨立的target
。 例如目標A和目標B.現在在xCode8
當我將keychain sharing
轉為ON時, B.entitlements
生成兩個A.entitlements
和B.entitlements
文件。 出乎意料的是,它們都具有相同的值:
<plist version="1.0">
<dict>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)target1.bundle.identifier</string>
</array>
</dict>
</plist>
我的意思是在兩個文件中都使用我的第一個目標的bundle identifier
; 當我手動嘗試更改其中一個的值時,另一個也會更改。
如您所知,當keychain-access-groups
的值與您用於簽名的配置文件的包標識符完全匹配時,xcode將不會對應用程序進行簽名。
所以我想知道我們如何為兩個單獨的目標的兩個單獨的權利文件提供兩個單獨的值?
我最后通過在我的權利中使用以下代碼來解決這個問題:
<plist version="1.0">
<dict>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</plist>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.