2016-11-08 94 views
1

我收到以下错误使用未声明的标识符NSOpenPanel的:错误:在Xcode

Use of undeclared identifier NSOpenPanel

NSOpenPanel *panel = [NSOpenPanel openPanel]; 
[panel setCanChooseFiles:NO]; 
[panel setCanChooseDirectories:YES]; 
[panel setAllowsMultipleSelection:YES]; // yes if more than one dir is allowed 
NSInteger clicked = [panel runModal]; 
if (clicked == NSFileHandlingPanelOKButton) 
{ 
    for (NSURL *url in [panel URLs]) 
    { 
     // do something with the url here. 
    } 
} 

回答

0

NSOpenPaneliOS可用,仅在macOSCocoa)。

您不能让用户浏览iOS下的文件系统。您可以使用Apples公共API浏览某些文件类型。例如,你可以让用户选择使用图像UIImagePickerController

+0

如何在objective-c中打开文件选取器?你可以发送示例代码吗? – Prabhu

+0

iOS下没有文件选择器。 – shallowThought

+0

然后如何以编程方式浏览文件? – Prabhu