【问题标题】:How do I create new subdirectories/folders withing my app bundle during runtime?如何在运行时在我的应用程序包中创建新的子目录/文件夹?
【发布时间】:2010-03-17 13:08:37
【问题描述】:

我正在将许多文件写入磁盘,我想将它们分成不同的类别,但我该怎么做呢?

【问题讨论】:

    标签: iphone subdirectory


    【解决方案1】:

    查看NSFileManager类中的以下方法:

    - (BOOL)createDirectoryAtPath:(NSString *)path attributes:(NSDictionary *)attributes
    - (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary *)attributes error:(NSError **)error
    

    还请注意,您不能将任何内容写入应用程序bundle。然而,应用程序沙箱包含几个您可以编写的文件夹(它们之间的选择取决于您的需要)。请参阅"Commonly Used Directories" 了解更多信息。

    【讨论】:

      猜你喜欢
      • 2013-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-05
      • 1970-01-01
      • 2021-01-18
      • 2013-10-22
      • 2014-05-11
      相关资源
      最近更新 更多