iOS开发

[MacOS开发]错误:The open file operat

2019-06-08  本文已影响1人  _小老虎_

在macos开发中,xcode调试文件模块时候,遇到问题

The open file operation failed to connect to the open and save panel service.

当时我的代码是这样子的:

openPanel.allowedFileTypes = [NSArray arrayWithObjects: @"ext1", @"ext2", nil];
openPanel.directoryURL = nil;
    
[openPanel beginSheetModalForWindow:[NSApplication sharedApplication].keyWindow completionHandler:^(NSModalResponse returnCode) {
        if (returnCode == 1) {
            NSURL *fileUrl = [[openPanel URLs] objectAtIndex:0];
            // xxx
        }
    }];

之后运行就提示了错误~~

最终官方文档查了一下这个问题:

具体还是因为在开发过程中选择了沙盒模式导致的:

小老虎
image.png

最终附上官网问题回答链接:
https://discussions.apple.com/thread/7329615

上一篇下一篇

猜你喜欢

热点阅读