如何重新签署 IPA 文件?

如何签署。在我使用不同的配置文件生成下面这样的 IPA 之后,使用配置文件生成 IPA 文件?我想签署一个测试的临时配置配置文件的 IPA,然后重新签署一个应用程序提交配置文件的应用程序商店的确切 IPA。

/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"
158268 次浏览

试试这个应用 Http://www.ketzler.de/2011/01/resign-an-iphone-app-insert-new-bundle-id-and-send-to-xcode-organizer-for-upload/

它应该能帮助你放弃 IPA 文件。我自己试过,但是在 Entitlements.plist 中无法通过一个错误。可能只是我的项目出了点问题。你应该试试。

检查 我辞职一个简单的工具如何做到这一点!

经过一番摸索,我找到了一个解决钥匙链感知辞职的办法。你可以在 https://gist.github.com/Weptun/5406993上查看

It's really easy to do from the command line. I had a gist of a script for doing this. It has now been incorporated into the ipa_sign script in https://github.com/RichardBronosky/ota-tools which I use daily. If you have any questions about using these tools, don't hesitate to ask.

The heart of it is this:

CODESIGN_ALLOCATE=`xcrun --find codesign_allocate`; export CODESIGN_ALLOCATE
IPA="/path/to/file.ipa"
PROVISION="/path/to/file.mobileprovision"
CERTIFICATE="Name of certificate: To sign with" # must be in keychain
# unzip the ipa
unzip -q "$IPA"
# remove the signature
rm -rf Payload/*.app/_CodeSignature
# replace the provision
cp "$PROVISION" Payload/*.app/embedded.mobileprovision
# sign with the new certificate (--resource-rules has been deprecated OS X Yosemite (10.10), it can safely be removed)
/usr/bin/codesign -f -s "$CERTIFICATE" Payload/*.app
# zip it back up
zip -qr resigned.ipa Payload

你的新签名应用叫做辞职 ipa

这是个老问题了,但是使用最新的 XCode,codesign很简单:

$ codesign -s my_certificate example.ipa


$ codesign -vv example.ipa
example.ipa: valid on disk
example.ipa: satisfies its Designated Requirement
  1. 通过使用. zip 更改扩展名来解压. ipa 文件
  2. 转到有效载荷。你会发现。应用程序文件
  3. 右键单击. app 文件并单击 Show package content
  4. Delete the _CodeSigned folder
  5. Replace the embedded.mobileprovision file with the new provision profile
  6. 转到 KeyChain Access,并确保与临时配置文件相关联的证书存在
  7. 执行下面提到的命令: /usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" --resource-rules "Payload/Application.app/ResourceRules.plist" "Payload/Application.app"

  8. 现在再次压缩 Payload 文件夹并用.ipa 更改.zip 扩展名

希望这对你有帮助。

参考以下连结: Http://www.modelmetrics.com/tomgersic/codesign-re-signing-an-ipa-between-apple-accounts/

Fastlane 的 叹气为辞职 IPAs 提供了一个相当强大的解决方案。

摘自他们的自述:

辞职

如果您生成了 ipa文件,但是希望对 ipa 文件应用不同的代码签名,那么可以使用 sigh resign:

fastlane sigh resign

sigh will find the ipa file and the provisioning profile for you if they are located in the current folder.

您可以使用命令行传递更多信息:

fastlane sigh resign ./path/app.ipa --signing_identity "iPhone Distribution: Felix Krause" -p "my.mobileprovision"

它甚至可以处理 为嵌套应用程序提供配置文件(例如,如果你有手表工具包应用程序)

我更新了布莱恩给我的塞拉利昂 iMac 的代码:

# this version was tested OK vith macOs Sierra 10.12.5 (16F73) on oct 0th, 2017
# original ipa file must be store in current working directory


IPA="ipa-filename.ipa"
PROVISION="path-to.mobileprovision"
CERTIFICATE="hexadecimal-certificate-identifier" # must be in keychain
# identifier maybe retrieved by running: security find-identity -v -p codesigning


# unzip the ipa
unzip -q "$IPA"


# remove the signature
rm -rf Payload/*.app/_CodeSignature


# replace the provision
cp "$PROVISION" Payload/*.app/embedded.mobileprovision


# generate entitlements for current app
cd Payload/
codesign -d --entitlements - *.app > entitlements.plist
cd ..
mv Payload/entitlements.plist entitlements.plist


# sign with the new certificate and entitlements
/usr/bin/codesign -f -s "$CERTIFICATE" '--entitlements' 'entitlements.plist'  Payload/*.app


# zip it back up
zip -qr resigned.ipa Payload

这里张贴的所有答案对我来说都不太管用,它们主要是跳过了签署嵌入式框架(或者包括权利)。

以下是我的工作方法(它假设工作目录中存在一个 ipa 文件) :

PROVISION="/path/to/file.mobileprovision"
CERTIFICATE="Name of certificate: To sign with" # must be in the keychain


unzip -q *.ipa
rm -rf Payload/*.app/_CodeSignature/


# Replace embedded provisioning profile
cp "$PROVISION" Payload/*.app/embedded.mobileprovision


# Extract entitlements from app
codesign -d --entitlements :entitlements.plist Payload/*.app/


# Re-sign embedded frameworks
codesign -f -s "$CERTIFICATE" --entitlements entitlements.plist Payload/*.app/Frameworks/*


# Re-sign the app (with entitlements)
codesign -f -s "$CERTIFICATE" --entitlements entitlements.plist Payload/*.app/


zip -qr resigned.ipa Payload


# Cleanup
rm entitlements.plist
rm -r Payload/

我一直在使用 https://github.com/xndrs/XReSign,它的工作真的很好。