简体   繁体   English

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

[英]Error: Use of undeclared identifier NSOpenPanel in Xcode

I'm getting the following error: 我收到以下错误:

Use of undeclared identifier NSOpenPanel 使用未声明的标识符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.
    }
}

NSOpenPanel is not available in iOS , only under macOS ( Cocoa ). NSOpenPaneliOS不可用,仅在macOSCocoa )下可用。

You can not let the user browse the file system under iOS . 您不能让用户在iOS下浏览文件系统。 You can browse certain file types though, using Apples public API. 您可以使用Apples公共API浏览某些文件类型。 For instance you can let the user choose images using UIImagePickerController 例如,您可以让用户使用UIImagePickerController选择图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM