【问题标题】:use of NSFilemanagerNSFilemanager 的使用
【发布时间】:2010-06-04 05:08:53
【问题描述】:

我作为一名 Iphone 开发人员工作了 5 个月,但我从未使用过 NSfilemanager 类。苹果有文档,但我仍然不清楚它的用途。我的问题是,谁能告诉我(举例)如何以及何时使用 NSfilemanager 类?任何帮助将不胜感激。谢谢。

【问题讨论】:

    标签: iphone objective-c nsfilemanager


    【解决方案1】:

    NSFileManager 用于对文件执行读写操作,将文件保存在您的应用程序中。检查指定文件是否存在于该位置。

    NSFileManager *fileManager = [NSFileManager defaultManager];
    // Get the path to the database in the application package
    NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:databaseName];
    
    // Check if the database has already been created in the users filesystem
    success = [fileManager fileExistsAtPath:databasePath];
    

    这是一个检查文件存在的例子。

    【讨论】:

      猜你喜欢
      • 2014-11-20
      • 2012-11-26
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      • 2014-12-13
      • 2012-03-28
      • 2014-05-03
      • 2015-10-15
      相关资源
      最近更新 更多