2015-11-04 121 views
1

我正在为我的应用沙箱创建授权密钥。我在授权密钥com.apple.security.temporary-exception.sbpl中遇到了一些问题。有五个例外,我需要添加到此密钥,它们是ipc-posix-sem,file-issue-extension,mach-lookup,file-write-createfile-read-data。因为我在Xcode之外制作这个应用程序(我正在使用Python),所以我必须手动创建授权文件。我已经“成功”了,但苹果似乎不喜欢我的格式。Apple Apple应用商店中的应用沙盒问题

这里是原代码:

<?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.files.user-selected.read-write</key> 
    <true/> 
    <key>com.apple.security.temporary-exception.sbpl</key> 
    <string> 
      (begin 
       (allow ipc-posix-sem) 
       (allow file-issue-extension) 
       (allow mach-lookup) 
       (allow file-write-create) 
       (allow file-read-data)) 
     </string> 
</dict> 
</plist> 

被拒绝com.apple.security.temporary-exception.sbpl后,我做了如下修改:

<?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.files.user-selected.read-write</key> 
    <true/> 
    <key>com.apple.security.temporary-exception.sbpl</key> 
    <array> 
     <string>(allow ipc-posix-sem)</string> 
     <string>(allow file-issue-extension)</string> 
     <string>(allow mach-lookup)</string> 
     <string>(allow file-write-create)</string> 
     <string>(allow file-read-data)</string> 
    </array> 
</dict> 
</plist> 

我的问题是:是我的新格式使用的正确方法.sbpl权利?品尝我的应用程序后,它会与这个新的授权文件一起工作,现在我只需要知道它是否适用于Apple。

我发现了herehere这两个授权文件的例子,我相信我的文件是在查看它们之后正确设置的。

回答

1

我发现另一个沙盒权利file in GitHub和您的格式看起来正确的我的眼睛。

我想另一个问题可能是你需要在像“mach-lookup”这样的命令之后提供参数。我正在查看Apple Sandbox Guide unofficial documentation found here

+0

我通过在命令后面添加参数来了解你的意思。 'mach-lookup'我想通了。我阅读了你与我联系的非官方文件,对于我的命令和他们的论点我有两个问题; 1.'ipc-posix-sem'后需要参数吗?当密钥处于非活动状态时,我的控制台输出:'deny ipc-posix-sem/mp-qfg08qha'。 2.对于'file-read-data'和'file-write-create',他们需要一个路径吗?我不明白我该怎么做,因为它们根据用户选择的文件路径或用户计算机上文件的位置(例如'/ Users/myname/Desktop/filename.png')而改变。 – Camon