如何在应用程序中使用授权证书进行辞职?

17

我有一个需要重新签名的.ipa文件。我尝试按照objc.io博客上的说明进行操作:

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

不过这还不够。当我进行代码签名时,会得到类似以下的内容:

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

我没有看到任何列出的授权。

但是,如果我在来自xCode的原始IPA文件上执行codesign -d --entitlements,我会得到:

<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>

我尝试了下面这行代码

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

但是以下密钥不包括:

  • beta-reports-activ
  • get-task-allow

那我该怎么做呢?我没有一个entitlements文件,在xCode 7中,只需要检查Capabilities。而且我只有苹果推送通知。

最后澄清一下我的要求:

  1. 我不会更改App ID或使用与xCode导出的不同的provisioning profile或code signing identity。
  2. 仅使用工具更改主可执行文件,因此需要重新签名。
2个回答

14

答案实际上在问题本身中已经非常明显了。输出结果为:

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

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

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

这将把许可证存储在entitlements.xml中,您可以将其用作参数自己签名.ipa文件:

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

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


11

它帮助了我:

--preserve-metadata=entitlements

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


5
这对我起作用了。 codesign --preserve-metadata=entitlements --force --verbose --sign "Apple Development" MyApp.app - user464014

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接