【发布时间】:2016-01-27 16:09:18
【问题描述】:
在我的应用程序中,当用户连接 USB 设备(电话)时,我使用NSWorkspaceDidMountNotification 通知用户通过执行NSAlert 检测到设备。
如果接受,应用程序继续从设备复制(读取)文本文件内容。在我启用 AppSandbox 之前,这一直很好。 我已启用 USB 授权,但现在当应用程序尝试复制时,我收到以下错误。
错误读取文件内容:错误域=NSCocoaErrorDomain 代码=257“无法打开文件“Office.txt”,因为您无权查看它。” UserInfo={NSFilePath=/Volumes/OfficeDrive//documents/Office.txt, NSUnderlyingError=0x600000049390 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not allowed"}}
如果启用 AppSandbox,是否可以从 USB 设备读取数据。
【问题讨论】:
标签: objective-c cocoa sandbox appstore-sandbox