错误:在Xcode中使用未声明的标识符NSOpenPanel

时间:2016-11-08 11:18:12

标签: ios objective-c xcode

我收到以下错误:

  

使用未声明的标识符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.
    }
}

1 个答案:

答案 0 :(得分:0)

仅在NSOpenPaneliOS)下macOS才提供

Cocoa

您无法让用户浏览iOS下的文件系统。您可以使用Apples公共API浏览某些文件类型。例如,您可以让用户使用UIImagePickerController

选择图像