resign .ipa with new distribution certificate

resign .ipa with new distribution certificate

Assumptions:

  1. .ipa filename is app.ipa
  2. app is called MyApp
  3. new provisioning profile resides at: ~/Downloads/AdHoc.mobileprovision
  4. distribution certificate name is Company Certificate
  5. may not need resource-rules parameter
  6. provisioning profile is either for Adhoc, or Enterprise distribution

Commands:

unzip app.ipa

rm -rf Payload/MyApp.app/_CodeSignature/

cp ~/Downloads/AdHoc.mobileprovision Payload/MyApp.app/embedded.mobileprovision 

codesign -f -s "iPhone Distribution: Company Certificate" --resource-rules Payload/MyApp.app/ResourceRules.plist  Payload/MyApp.app

zip -qr app-resigned.ipa Payload/