How to locate the entitlements plist file in an XC

2019-07-14 11:43发布

I have a relatively complicated problem, described below for the context. The solution seems to boil down to editing the entitlements plist file manually.

I cannot find any entitlements.plist file in my project, and could not find any "entitlements" sections in other plist files I found.

The question is, how can I locate the entitlements plist file?


Now for the background story:

I need to create a new provisioning profile for an enterprise app we have deployed (the old one will expire shortly). There are several versions out there running in different environments (all with the same app ID). For some reason the current version of the app no longer includes the entitlement "com.apple.developer.team-identifier". When renewing the provisioning profile, this entitlement is automatically removed from the profile as well. This causes all the older versions of the app to stop working. They fail to start with this error in the console log:

entitlement 'com.apple.developer.team-identifier' has value not permitted by provisioning profile 'My Profile'

According to Apple Support, we have to update all those apps to the latest version, which of course is not possible since some are in production on older environments and are not all compatible with the newest capabilities. (We are not planning to give all customers a free upgrade either). So, Apple's official solution is not an option.

According to this comment on a related issue it should be possible to re-introduce the dependency on the missing entitlement. I figured that if I could add the entitlement to the current app, regenerate it and then generate a new provisioning profile for it, the problem might be solved.

1条回答
爷、活的狠高调
2楼-- · 2019-07-14 12:16

Answer

My app was using the default capabilities in which case there is no entitlements.plist file. I was able to add one by adding some capabilities in the UI (and then removing them again).

Follow up

In the end this did not solve my problem, which turned out to be different since this entitlement was already in the previously generated profile (with default capabilities). I only noticed this when comparing the generated profiles (they were identical).

The error in the console log seems to be caused by a difference in the plist:

Previous provisioning profile:

<key>com.apple.developer.team-identifier</key>
<array>
    <string>SomeIdentifier</string>
</array>

New provisioning profile:

<key>com.apple.developer.team-identifier</key>
<string>SomeIdentifier</string>

It may be possible to get the provisioning profile compatible again by adding an extra team-identifier so that it becomes an array again, but that's a different question that the one I asked here.

查看更多
登录 后发表回答