gpt4 book ai didi

ios - IOS中NSPicturesDirectory的用途

转载 作者:行者123 更新时间:2023-11-28 20:02:36 25 4
gpt4 key购买 nike

Foundation Constants Reference什么是

NSMoviesDirectory
NSMusicDirectory
NSPicturesDirectory

如果我正在处理图像,我应该将其存储在 NSPicturesDirectory 中吗?

最佳答案

NSSearchPathDirectory 枚举定义了您应该存储特定类型文件的文件夹位置。
这个想法是,这些位置决定了用户期望找到应用程序/文档/图片/电影的路径......

例如

typedef NS_ENUM(NSUInteger, NSSearchPathDirectory) {
NSApplicationDirectory = 1, // supported applications (Applications)
...
NSLibraryDirectory, // various documentation, support, and configuration files, resources (Library)
NSDocumentationDirectory, // documentation (Documentation)
NSDocumentDirectory, // documents (Documents)
...
NSDesktopDirectory = 12, // location of user's desktop
...
NSMoviesDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 17, // location of user's Movies directory (~/Movies)
NSMusicDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 18, // location of user's Music directory (~/Music)
NSPicturesDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 19, // location of user's Pictures directory (~/Pictures)
...
NSTrashDirectory NS_ENUM_AVAILABLE(10_8, NA) = 102 // location of Trash directory
};

现在...真正的位置(文件路径)取决于您的应用程序的存储位置。
由于在 IOS 中没有用户可见的文件系统,尤其是因为每个应用程序都在自己的沙箱中运行,因此它们的用途有限:
他们只告诉操作系统在哪里可以找到什么,然后它可能会假设如何处理这些位置:例如缓存可以随意丢弃,文档必须保留...电影/图片也是

请记住,虽然 IOS 只能看到缓存/其他任何东西,但 OSX 肯定会以不同的方式对待路径

关于ios - IOS中NSPicturesDirectory的用途,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23335316/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com