如何使用Xcode5在Mac应用程序中对签名的可执行文件进行代码签名 [英] How can I code sign a bundled executable file in a mac app using xcode5

查看:215
本文介绍了如何使用Xcode5在Mac应用程序中对签名的可执行文件进行代码签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用xCode 5创建的应用程序,其中包含捆绑的可执行文件。我正在尝试将应用程序提交到Mac App Store,但是当我提交应用程序时,它失败并显示以下消息:

I have an App created in xCode 5 which includes a bundled executable file. I am trying to submit the app to the Mac App store, however when I submit it it fails with the following message:

未启用应用程序沙箱-以下可执行文件必须包括权利属性列表中布尔值true的 com.apple.security.app-sandbox权利。有关将应用程序沙箱化的更多信息,请参阅应用程序沙箱页面。

App sandbox not enabled - The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list. Refer to the App Sandbox page for more information on sandboxing your app.

我创建了一个授权文件(EXECUTABLE_NAME.entitlements),其中包含'com.apple.security。 app-sandbox键,其值为'true'...

I have created an entitlements file (EXECUTABLE_NAME.entitlements), containing the 'com.apple.security.app-sandbox' key with a value of 'true'...

<?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>com.apple.security.app-sandbox</key>
        <true/>
    </dict>
</plist>

...但是应用仍然失败。

...but the app still fails.

我缺少什么(或者我做错了什么)来对捆绑的可执行文件代码进行签名?

What am I missing (or what have I done wrong) to get the bundled executable file code signed?

推荐答案

I通过以下方式解决了此问题:

I resolved this issue in the following manner:

1).plist文件缺少继承键,因此我对其进行了修改:

1) the .plist file was missing the inherit key, so I modified it thus:

<?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>com.apple.security.app-sandbox</key>
        <true/>
        <key>com.apple.security.inherit</key>
        <true/>
    </dict>
</plist>

单独执行该操作,实际上对文件进行代码签名我做了以下操作:

that on its own won't do the job, to actually code sign the file I did the following:


  1. 归档应用程序

  2. 打开xCode的管理器窗口

  3. 右键单击存档,然后选择在Finder中显示以获取其位置

  4. 使用Terminal.app,导航至其位置,然后在应用程序
    包中/内容/资源/

  5. 运行以下命令:

  1. archive the app
  2. open xCode's Organizer window
  3. right-click on the archive and select 'Show in Finder' to get its location
  4. With Terminal.app, navigate to its location and then inside the app bundle /Contents/Resources/
  5. Run the following command:

codesign -f -s $ YOUR_CERTIFICATE_HERE-授权 $ THE_ENTITLEMENTS_PLIST $ THE_EXECUTABLE

codesign -f -s "$YOUR_CERTIFICATE_HERE" --entitlements "$THE_ENTITLEMENTS_PLIST" "$THE_EXECUTABLE"

$ YOUR_CERTIFICATE_HERE 使用您的第三方Mac开发者应用程序证书

for $YOUR_CERTIFICATE_HERE use your 3rd Party Mac Developer Application certificate

完成此操作后,该应用程序应上传到iTunes Connect,您将可以在二进制详细信息部分。

Once this is done, the app should upload to iTunes Connect and you will be able to see the relevant code signing information under the 'Binary Details' section.

这篇关于如何使用Xcode5在Mac应用程序中对签名的可执行文件进行代码签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆