退出 iOS 配置文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15634188/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Resigning an iOS provisioning profile
提问by Koko Carl
My client has an iOS app with In-app purchase, Game-kit and Push notifications enabled, it is currently on the app store. I would like to resign the application using an in-house enterprise distribution certificate, to test internally, but still be able to test services tied to the original provisioning profile. Is this possible?
我的客户有一个 iOS 应用程序,其中启用了应用程序内购买、游戏套件和推送通知,它目前在应用程序商店中。我想使用内部企业分发证书退出应用程序,进行内部测试,但仍然能够测试与原始配置文件相关的服务。这可能吗?
回答by Koko Carl
I ended up doing this, which is a combination of :-
我最终这样做了,这是以下内容的组合:-
and
和
1) Create Entitlements plist, prevent issues with the Keychain etc
1)创建权利plist,防止钥匙串等问题
<?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>application-identifier</key>
<string>GBA9L2EABG.com.your.bundle.id.MyApp</string>
<key>get-task-allow</key>
<false/>
</dict>
2) Unzip the IPA
2)解压IPA
unzip Application.ipa
3) Remove the old code signature
3) 去除旧的代码签名
rm -r "Payload/Application.app/_CodeSignature" "Payload/Application.app/CodeResources" 2> /dev/null | true
4) Replace embedded mobile provisioning profile
4) 替换嵌入式移动配置文件
cp "MyEnterprise.mobileprovision" "Payload/Application.app/embedded.mobileprovision"
5) Resign
5) 辞职
/usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" --resource-rules "Payload/Application.app/ResourceRules.plist" --entitlements Entitlements.plist "Payload/Application.app"
6) Re-package
6) 重新包装
zip -qr "Application.resigned.ipa" Payload
回答by Blitz
To resign an app a bit easier than what @Koko Carl has said, we have adapted the floatsign script, which can be found at https://gist.github.com/Weptun/5406993. Makes the process really easy:
为了比@Koko Carl 所说的更容易退出应用程序,我们调整了 floatsign 脚本,该脚本可以在https://gist.github.com/Weptun/5406993上找到。使过程非常简单:
sh floatsign.sh ~/Downloads/File.ipa "iPhone Distribution: CertificateName" -b new.bundle.id -p /Path/To/Profile/Appstore.mobileprovision App-resigned.ipa
回答by coder284
When searched this is the first question shownup in stackover flow. So wanted to updated with the latest iResign mac app, which makes the job super easy with GUI instead of commands in terminal.
搜索时,这是 stackover 流程中显示的第一个问题。所以想用最新的 iResign mac 应用程序进行更新,这使得使用 GUI 而不是终端命令的工作变得非常容易。
iReSign
重新签名
iReSign allows iDevice app bundles (.ipa) files to be signed or resigned with a digital certificate from Apple for distribution. It can also create signed iDevice app bundles (.ipa) files from .xcarchive files. This tool is aimed at enterprises users, for enterprise deployment, when the person signing the app is different than the person(s) developing it.
iReSign 允许使用 Apple 的数字证书对 iDevice 应用程序包 (.ipa) 文件进行签名或重新签名以进行分发。它还可以从 .xcarchive 文件创建签名的 iDevice 应用程序包 (.ipa) 文件。当签署应用程序的人与开发它的人不同时,此工具针对企业用户,用于企业部署。
How to use
如何使用
iReSign allows you to re-sign any unencrypted ipa-file with any certificate for which you hold the corresponding private key. iResign can also created a signed ipa-file from an xcarchive file.
iReSign 允许您使用您持有相应私钥的任何证书重新签署任何未加密的 ipa 文件。iResign 还可以从 xcarchive 文件创建一个签名的 ipa 文件。
Drag your unsigned .ipa or .xcarchive file to the top box, or use the browse button.
将您未签名的 .ipa 或 .xcarchive 文件拖到顶部框,或使用浏览按钮。
Enter your full certificate name from Keychain Access, for example "iPhone Developer: Firstname Lastname (XXXXXXXXXX)" in the bottom box.
从 Keychain Access 输入您的完整证书名称,例如在底部框中输入“iPhone Developer: Firstname Lastname (XXXXXXXXXX)”。
Click ReSign! and wait. The resigned file will be saved in the same folder as the original file.
点击重新签名!等待。辞职的文件将保存在与原始文件相同的文件夹中。
回答by tonyg
Just to add a little bit to Koko Carl's response, if you run into problems with codesign_allocate when you get to step 5 (Resign), try exporting a shell variable CODESIGN_ALLOCATE and give it a path to the codesign allocate within the iPhone SDK. To do this, make sure you have the xcode command line tools installed (Preferences/Updates in Xcode)
只是在 Koko Carl 的回复中补充一点,如果您在执行第 5 步(辞职)时遇到 codesign_allocate 问题,请尝试导出 shell 变量 CODESIGN_ALLOCATE 并为其指定一个指向 iPhone SDK 中 codesign 分配的路径。为此,请确保已安装 xcode 命令行工具(Xcode 中的首选项/更新)
For example, I was getting the error:
例如,我收到错误:
me$ /usr/bin/codesign -f -v -s "iPhone Distribution: Some Company, Inc" --resource-rules "Payload/MyApp.app/ResourceRules.plist" --entitlements Entitlements.plist "Payload/MyApp.app"
Output:
输出:
Payload/MyApp.app: replacing existing signature
codesign_allocate: object: /Users/mimio/Downloads/Payload/MyApp.app/MyApp malformed object (unknown load command 33)
Payload/MyApp.app: object file format unrecognized, invalid, or unsuitable
To solve this, I set the variable thusly:
为了解决这个问题,我这样设置变量:
me$ export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
And then ran my command again:
然后再次运行我的命令:
me$ /usr/bin/codesign -f -v -s "iPhone Distribution: Some Company, Inc" --resource-rules "Payload/MyApp.app/ResourceRules.plist" --entitlements Entitlements.plist "Payload/MyApp.app"
And voila! Everything worked properly with the new codesign_allocate
瞧!使用新的 codesign_allocate 一切正常