重新编译没有沙盒的旧可可应用 [英] Recompiling old cocoa app without sandbox

查看:109
本文介绍了重新编译没有沙盒的旧可可应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个Cocoa应用程序是私下分发的,并且不使用应用程序商店。至少一年没有碰过它们。我需要做些改变。它们无法与Apple的沙盒配合使用。我曾尝试在Xcode(9.4.1)中关闭沙箱功能,但是似乎没有授权文件被解释为沙箱功能。我注意到,命令行应用程序还没有这个问题。我该如何恢复以前的行为?过去,我对应用程序进行了签名以最大程度地减少用户的困惑,因此,如果可能的话,我想继续对应用程序进行签名。

I have a couple of Cocoa apps that are distributed privately and do not use the app store. They haven't been touched for at least a year. I need to make some changes. They don't work properly with Apple's sandbox. I've tried to turn off sandboxing in Xcode (9.4.1), but the absence of an entitlements file seems to be interpreted as sandboxed. I've noticed that command line applications don't have this problem (yet). How can I get the old behavior back? In the past I signed the apps to minimize user confusion, so I would like to continue signing the apps, if possible.

更新:我创建了一个仅调用NSOpenPanel(),像这样-

Update: I created a simple app that only calls NSOpenPanel(), like this -

@IBAction func browseFile(sender: AnyObject) {

        let dialog = NSOpenPanel()

        dialog.title                   = "Choose a .pdf file"
        dialog.showsResizeIndicator    = true
        dialog.showsHiddenFiles        = false
        dialog.canChooseDirectories    = true
        dialog.canCreateDirectories    = false
        dialog.allowsMultipleSelection = false
        dialog.allowedFileTypes        = ["pdf"]

        if (dialog.runModal() == NSApplication.ModalResponse.OK) {
            let result = dialog.url // Pathname of the file

我尝试在Xcode 8和Xcode 9下进行构建。似乎签名过程中的某些内容已更改。如果我启用沙箱并提供适当的权利,则该应用程序将运行而不会出现错误。否则,我将收到以下错误:

I tried building under Xcode 8 and Xcode 9. It seems something in the signing process has changed. If I enable sandboxing and give the appropriate entitlements, then the app runs without errors. Otherwise, I get the following error:

Faild to get owner UUID for url: file:///Users/david/Public error: Error

请注意,此文件包含以下权利文件:

Note that this is with an entitlements file containing:

<?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>
    <false/>
</dict>
</plist>

此外,我不清楚大卫在哪里。

Also, I'm not clear where "david" comes into this.

推荐答案

显然,根据Apple技术支持,这是NSOpenPanel中的错误。当前,他们无法解释错误消息的内容,也不能解释为什么仅在关闭沙箱时才会发生错误消息。我向Apple提交了错误报告。

Apparently this is a bug in NSOpenPanel, per Apple Technical Support. Currently they can not explain the contents of the error message, or why it only occurs when sandboxing is turned off. I filed a bug report with Apple.

这篇关于重新编译没有沙盒的旧可可应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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