Fastlane's sigh provides a fairly robust solution for resigning IPAs.
From their README:
Resign
If you generated your
ipa
file but want to apply a different code signing onto the ipa file, you can usesigh resign
:
fastlane sigh resign
sigh
will find the ipa file and the provisioning profile for you if they are located in the current folder.You can pass more information using the command line:
fastlane sigh resign ./path/app.ipa --signing_identity "iPhone Distribution: Felix Krause" -p "my.mobileprovision"
It will even handle provisioning profiles for nested applications (eg. if you have watchkit apps)