xcode 如何退出具有权利的应用程序?

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

How do I resign app with entitlements?

iosxcodecodesigncode-signing-entitlements

提问by Erik Engheim

I have an .ipa file which I need to resign. I tried doing it as explained on the objc.io blog:

我有一个需要辞职的 .ipa 文件。我尝试按照objc.io 博客上的说明进行操作

$ codesign -f -s 'iPhone Developer: Thomas Kollbach (7TPNXN7G6K)' Example.app

However this is insufficient. When I do codesign I get something like this:

然而这是不够的。当我进行协同设计时,我会得到这样的信息:

$ codesign -d --entitlements - Example.app/Example
Executable=/Users/myuser/Payload/Example.app/Example

I don't get any entitlements listed.

我没有列出任何权利。

However if I do codesign -d --entitlementson the original IPA file from xCode I get:

但是,如果我codesign -d --entitlements对来自 xCode 的原始 IPA 文件进行处理,我会得到:

<plist version="1.0">
<dict>
    <key>application-identifier</key>
    <string>UFAYDHAUP.com.company.example</string>
    <key>aps-environment</key>
    <string>production</string>
    <key>beta-reports-active</key>
    <true/>
    <key>com.apple.developer.team-identifier</key>
    <string>UFAYDHAUP</string>
    <key>get-task-allow</key>
    <false/>
    <key>keychain-access-groups</key>
    <array>
        <string>UFAYDHAUP.com.company.example</string>
    </array>
</dict>
</plist>

I tried the line below

我尝试了下面的行

 codesign --entitlements Example.app/archived-expanded-entitlements.xcent -f -s 'iPhone Developer: Thomas Kollbach (7TPNXN7G6K)' Example.app

But the following keys are not included:

但不包括以下键:

  • beta-reports-activ
  • get-task-allow
  • 测试报告-活动
  • 获取任务允许

So how am I supposed to do this? I don't have an entitlements file, in xCode 7, one only checks Capabilities. And all I have is Apple Push notifications.

那么我该怎么做呢?我没有权利文件,在 xCode 7 中,只能检查 Capabilities。我所拥有的只是 Apple 推送通知。

Finally to clarify my requirements:

最后澄清我的要求:

  1. I will not change App ID or use different provisioning profile or code signing identity compared to what xCode exports.
  2. Only the main executable is changed with a tool, which is why a resign is needed.
  1. 与 xCode 导出的内容相比,我不会更改 App ID 或使用不同的配置文件或代码签名标识。
  2. 使用工具仅更改主要可执行文件,这就是需要辞职的原因。

回答by Erik Engheim

The answer is actually quite self evident in the question itself. The output from:

答案实际上在问题本身中是不言而喻的。输出来自:

$ codesign -d --entitlements - Example.app/Example

Is actually a perfectly valid entitlements file. So you can store the output from the original .ipa exported from xCode by writing:

实际上是一个完全有效的权利文件。因此,您可以通过编写以下内容来存储从 xCode 导出的原始 .ipa 的输出:

$ codesign -d --entitlements entitlements.xml Example.app/Example

This will store the entitlements in entitlements.xmlwhich you can then use in an argument to sign the .ipa file yourself:

这将存储entitlements.xml您可以在其中使用的权利,以便您自己对 .ipa 文件进行签名:

codesign --entitlements entitlements.xml   -f -s "iPhone Distribution: Company (UFAYDHAUP)" Payload/Example.app

Naturally "iPhone Distribution: Company (UFAYDHAUP)" has to be replaced with the signing identify you use and Payload/Example.appwill be the path to your app which has been unzipped from the .ipa file.

自然地,“iPhone Distribution: Company (UFAYDHAUP)”必须替换为您使用的签名标识,并且Payload/Example.app将是从 .ipa 文件解压缩到您的应用程序的路径。

回答by ZevsVU

It helped me:

它帮助了我:

--preserve-metadata=entitlements

Saving and restoring entitlements are not needed anymore.

不再需要保存和恢复权利。