Posts tagged ‘Mobile Provision’

iOS Mobileprovision expired? No problem! – Update

Last year, I wrote a quick article on how to re-sign an IPA, replacing an expired mobile provisioning profile.

It turns out that with the latest versions of Xcode, the code provided doesn’t work anymore. It’s requiring an extra step now.

Let’s take a look a the code that was posted last year:

unzip app.ipa
rm -rf Payload/MyApp.app/_CodeSignature/
cp ~/Downloads/MyProfile.mobileprovision Payload/MyApp.app/embedded.mobileprovision
codesign -f -s “iPhone Distribution: Name Of My Certificate” –resource-rules Payload/MyApp.app/ResourceRules.plist Payload/MyApp.app
zip -qr app-resigned.ipa Payload/

The step missing is right before the codesign command.

The new Xcode requires you to provide an entitlements file that describes the app before you codesign. Here’s what the Plist file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>get-task-allow</key>
	<false/>
	<key>application-identifier</key>
	<string>TEAMID.BUNDLE-IDENTIFIER</string>
</dict>
</plist>

After replacing the TEAMID and the BUNDLE-IDENTIFIER placeholders with what’s provided in your mobileprovision file. To see what is in the mobileprovision file, simply run this command:

security cms -D -i <mobileprovision file here>

You should see a block under &lt;Entitlements&gt; with the application-identifier you need to add to your own Entitlements.plist file.

Once you’re done editing your Entitlements file, run the codesign command like this:

codesign -f –entitlements “Entitlements.plist” -s “iPhone Distribution: Name Of My Certificate”¬†Payload/MyApp.app

PLEASE NOTE: You need to NOT include this Entitlements.plist file in your Payload directory. This is used for code signing ONLY.

Here’s the full new set of commands to run:

security cms -D -i <mobileprovision file here>
<Modify your Entilements.plist file here>
<Save file as Entitlements.plist>

unzip app.ipa
rm -rf Payload/MyApp.app/_CodeSignature/
cp ~/Downloads/MyProfile.mobileprovision Payload/MyApp.app/embedded.mobileprovision
codesign -f –entitlements “Entitlements.plist” -s “iPhone Distribution: Name Of My Certificate”¬†Payload/MyApp.app
zip -qr app-resigned.ipa Payload/

Enjoy!

Simon