Thursday, November 3, 2016

How to programmatically get team id after build ipa file

The easiest way to get team id from ios IPA file is set the following key-value pair in info.plist file

<key>AppIdentifierPrefix</key>
<string>$(AppIdentifierPrefix)</string>

After building the xcode project, open the app bundle ipa package, the generated info.plist file will replace the placeholder of $(AppIdentifierPrefix) with the real team id used to sign the ipa file. You can also programmatically read the value based on the key of AppIdentifierPrefix at runtime.

However, this only works if the ipa will not be resigned with a different  entitlement file. If the ipa file is resigned with a different certificate and entitlement file, the easy way to find the team id is first writing an item in keychain and then read the item's access group back, it will include the team id information in the access group attribute.

1 comment: