重新签署 IPA (iPhone) [英] Re-sign IPA (iPhone)
问题描述
我目前使用 xcodebuild 和 xcrun 使用 hudson 构建我的所有应用程序,没有任何问题
I currently build all my applications with hudson using xcodebuild followed by a xcrun without any problems
我收到了一些来自不同人的 IPA 文件,我想使用企业帐户而不是公司帐户(用于应用商店,或有时是临时分发的)重新签署这些文件.
I've received a couple of IPA files from different people that I would like to re-sign with a enterprise account instead of the corporate account (for the app store, or sometimes ad-hoc distributed).
我的问题是,当我尝试退出应用程序时,它不会安装在我的设备上(并且应该安装,因为它是企业版本).错误消息在设备上(不在 iTunes 中),它只是告诉我它无法安装该应用程序.没有提供更多信息.
My problem is that when I try to resign the app, it won't install on my device (and it should since it's a Enterprise build). The error message is on the device (not in iTunes) and it tells me simply that it couldn't install the app. No more information is given.
我找到了一些信息,( http://www.ketzler.de/2011/01/resign-an-iphone-app-insert-new-bundle-id-and-send-to-xcode-organizer-for-upload/ )
I've found some information, ( http://www.ketzler.de/2011/01/resign-an-iphone-app-insert-new-bundle-id-and-send-to-xcode-organizer-for-upload/ )
这或许是可能的.我面临的问题是,它似乎没有像我使用正常构建(使用 xcrun)那样嵌入移动配置文件,这是否可以使用协同设计工具进行控制,或者是否可以使用 xcrun 重新签名?
And this might be possible. The problem I'm facing is that it doesn't seem to embed the mobile provisioning profile as I do with my normal builds (using xcrun) is this possible to control with the codesign tool, or is it possible to re-sign with xcrun?
我现在用我的辞职脚本
- 解压 app.ipa
- appname=$(ls Payload)
- xcrun -sdk iphoneos PackageApplication -s "$provisioning_profile" "$project_dir/Payload/$appname" -o "$project_dir/app-resigned.ipa" --sign "$provisioning_profile" --embed "$mobileprovision"
我查看了生成的 ipa 文件,它似乎与原始应用程序非常相似.哪些文件应该在这里真正改变?我最初认为 _CodeSignature/CodeResources 会改变,但内容看起来几乎完全一样.
I've looked in the resulting ipa file and it seems to be very similar to the original app. What files should really change here? I initially thought the the _CodeSignature/CodeResources would change, but the content looks pretty much exactly the same.
非常感谢指针.
推荐答案
终于搞定了!
使用使用 cert1 签名的 IPA 进行测试,用于应用商店提交,且未在配置文件中添加任何设备.结果是使用企业帐户签名的新 IPA 和用于内部部署的移动配置文件(移动配置文件嵌入到 IPA).
Tested with a IPA signed with cert1 for app store submission with no devices added in the provisioning profile. Results in a new IPA signed with a enterprise account and a mobile provisioning profile for in house deployment (the mobile provisioning profile gets embedded to the IPA).
解决方案:
解压 IPA
unzip Application.ipa
删除旧的代码签名
rm -r "Payload/Application.app/_CodeSignature" "Payload/Application.app/CodeResources" 2> /dev/null | true
替换嵌入式移动配置文件
Replace embedded mobile provisioning profile
cp "MyEnterprise.mobileprovision" "Payload/Application.app/embedded.mobileprovision"
重新签名
/usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" --resource-rules "Payload/Application.app/ResourceRules.plist" "Payload/Application.app"
重新打包
zip -qr "Application.resigned.ipa" Payload
删除了权利部分(见小巷评论,谢谢)
Removed the Entitlement part (see alleys comment, thanks)
这篇关于重新签署 IPA (iPhone)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!