Resign iOS App from a distribution identity to a developer identity

不羁的心 提交于 2019-12-05 19:09:59

If you want to adapt your original entitlements you can do this.

Grab the original distribution entitlements:

/usr/libexec/PlistBuddy -x -c "print :Entitlements " /dev/stdin <<< $(security cms -D -i production.app/embedded.mobileprovision) > entitlements.plist

Turn them into Development entitlements with

/usr/libexec/PlistBuddy -c 'Set :get-task-allow true' entitlements.plist

and update any other entitlements that can differ, e.g. push notifications

/usr/libexec/PlistBuddy -c'Set :aps-environment development' entitlements.plist

p.s. no need to remove _CodeSignature, codesign -f will replace it for you.

I finally found the problem, When a developer identity is used during a build, Xcode embed an Entitlements.plist file that contains a get-task-allow => true, when the identity is distribution, this get-task-allow is set to false. When the "distribution" app was "resigned", I was not passing a --entitlements option to codesign, so the app was still not a valid "developer" app for instruments.

Adding an Entitlements.plist file with a get-task-allow set to true in my project and referencing it in my Distribution configuration solved the problem, now when the app is built it contains get-task-allow => true, and when it is resigned, I pass this same Entitlements.plist to the codesign option.

It works for now, I hope that the other keys added by Xcode to the Entitlements file won't miss (since the one I'm using in my codesign command call only contains the get-task-allow key).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!