在 xcode 之外退出应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6569120/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:24:22  来源:igfitidea点击:

Resigning an application outside xcode

iphonexcodeipadipaentitlements

提问by Ompah

I have some apps i wanna resign with a different apple developer license,

我有一些应用程序我想用不同的苹果开发者许可证辞职,

Problem is, i dont have source code, only the ipa file, the app and the archiveinfo.plist is it possible for me to resign the app if i dont have the source code?

问题是,我没有源代码,只有 ipa 文件、应用程序和 archiveinfo.plist 如果我没有源代码,我可以退出应用程序吗?

Thanks! Ompah

谢谢!欧帕

回答by Reid Rankin

The ability to replace the signature on an already-signed binary is built into the codesign utility. That way, if your developer certificate expires (as they do annoyingly often), you don't have to rebuild your app.

替换已签名二进制文件上的签名的功能内置于 codesign 实用程序中。这样,如果您的开发人员证书过期(因为它们经常令人讨厌),您就不必重新构建您的应用程序。

This can be important, especially if you need to support an old app version, and you've made code alterations since you archived your IPA.

这可能很重要,特别是如果您需要支持旧的应用程序版本,并且自从您归档您的 IPA 以来您已经进行了代码更改。

I usually use this script. It comes in handy when trading debug build IPAs with people who have their own developer accounts and who I don't want to burn a UDID slot for, and who don't want to have to load my provisioning profiles on their devices.

我通常使用这个脚本。当与拥有自己的开发人员帐户、我不想为其烧录 UDID 插槽以及不想在他们的设备上加载我的配置文件的人交易调试构建 IPA 时,它会派上用场。

#!/bin/sh

TEMPDIR=/tmp/$RANDOM-$RANDOM-$RANDOM
RESOURCERULES=/tmp/ResourceRules-$RANDOM$RANDOM.plist
CURRENTDIR=`pwd`

mkdir -p "$TEMPDIR"

cat - > "$RESOURCERULES" <<ResourceRulesPlistDelimiter
<?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>rules</key>
    <dict>
        <key>.*</key>
        <true/>
        <key>Info.plist</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>10</real>
        </dict>
        <key>ResourceRules.plist</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>100</real>
        </dict>
    </dict>
</dict>
</plist>
ResourceRulesPlistDelimiter

unzip -q "" -d "$TEMPDIR" || exit 1
xattr -d -r com.apple.quarantine "$TEMPDIR"

for APPBUNDLE in "`find "$TEMPDIR" -name "*.app"`"; do
    codesign --resource-rules="$RESOURCERULES" -f -s "iPhone Developer" "$APPBUNDLE"
    codesign -dvvvv -r- "$APPBUNDLE"
done

cd "$TEMPDIR"
zip -qr "$TEMPDIR.zip" "Payload" && cd "$CURRENTDIR" && mv "" ".bak" && mv "$TEMPDIR.zip" ""
cd "$CURRENTDIR"
rm -rf "$TEMPDIR.zip"
rm -rf "$TEMPDIR"
rm -rf "$RESOURCERULES"

回答by Joel Fischer

This is the most effective and efficient solution I have come up with so far.

这是迄今为止我提出的最有效和最高效的解决方案。

  1. Make sure you are using a Mac. This process requires an application for Mac OSX.

  2. Take the .ipa file, rename it to a .zip file.

  3. Extract the zip file, you will see a folder called “Payload” containing a .app file.

  4. Download the Mac OSX app AppResigner here: http://www.gorbster.net/misc/AppResigner.app.zip

  5. Unzip the app. Inside the unzipped folder you will see the Mac App “AppResigner”

  6. Open this app. It will ask you to choose a file. Choose the .app we unzipped from the .ipa file.

  7. It will ask you for a signing identity. Open the Mac App “Keychain Access”. The steps that you will take here may vary slightly. Open the keychain “login” and choose category “Certificates”

  8. Here you need to find the certificate with which you want to resign the app. For example it could be: “iPhone Distribution: Your Company Name”, you will need to have access to your company's Distribution profile to use a distribution certificate. I have not tried doing this with a development certificate, I don't know if that will work.

  9. Type in this certificate name exactly as it is shown here into the AppResigner prompt; copy / paste was not working correctly for me.

  10. AppResigner should tell you that the app has been resigned.

  11. Find the .app file that you resigned (it is the same one as before) and zip it up. I use the Mac OSX program Keka, but many are available.

  12. Rename the zip file to a .ipa file.

  13. Done!

  1. 确保您使用的是 Mac。此过程需要适用于 Mac OSX 的应用程序。

  2. 获取 .ipa 文件,将其重命名为 .zip 文件。

  3. 解压 zip 文件,您将看到一个名为“Payload”的文件夹,其中包含一个 .app 文件。

  4. 在此处下载 Mac OSX 应用程序 AppResigner:http: //www.gorbster.net/misc/AppResigner.app.zip

  5. 解压缩应用程序。在解压后的文件夹中,您将看到 Mac 应用“AppResigner”

  6. 打开这个应用程序。它会要求您选择一个文件。选择我们从 .ipa 文件中解压出来的 .app。

  7. 它会要求您提供签名身份。打开 Mac 应用程序“钥匙串访问”。您将在此处采取的步骤可能略有不同。打开钥匙串“登录”并选择类别“证书”

  8. 在这里,您需要找到要用于退出应用程序的证书。例如,它可能是:“iPhone 分发:您的公司名称”,您将需要访问贵公司的分发配置文件才能使用分发证书。我没有试过用开发证书来做这个,我不知道这是否可行。

  9. 在 AppResigner 提示中输入与此处显示的完全相同的证书名称;复制/粘贴对我来说不能正常工作。

  10. AppResigner 应该告诉您该应用程序已被辞职。

  11. 找到你辞职的 .app 文件(和以前一样)并压缩它。我使用 Mac OSX 程序 Keka,但有很多可用。

  12. 将 zip 文件重命名为 .ipa 文件。

  13. 完毕!