[英]Error: Use of undeclared identifier NSOpenPanel in 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.
}
}
NSOpenPanel
在iOS
不可用,僅在macOS
( Cocoa
)下可用。
您不能讓用戶在iOS
下瀏覽文件系統。 您可以使用Apples公共API瀏覽某些文件類型。 例如,您可以讓用戶使用UIImagePickerController選擇圖像
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.