文件的创建 判断是否存在文件 读取 写入

//http://seven-sally.lofter.com/post/19d861_54e83e

文件 沙盒机制 参考查看原文

http://www.2cto.com/kf/201404/290149.html

iOS的四种方法读取文件内容

http://hi.baidu.com/caoruifang/item/ba101ec4603c5bc8964452bf

ios 文件管理 获取文件属性 读取文件

代码: 判断 本地是否有XX.txt/XX.plist等命名的文件
-(BOOL)judgeFileExist:(NSString * )fileName
{
    //获取文件路径
    NSArray    *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
    NSString *path=[paths        objectAtIndex:0];
    NSString *filepath=[path stringByAppendingPathComponent:fileName];
    NSFileManager *fileManager = [NSFileManager defaultManager];
   return  [fileManager fileExistsAtPath:filepath];
//返回 YES 存在  NO不存在
}

转载于:https://www.cnblogs.com/someonelikeyou/p/3761648.html

猜你喜欢

转载自blog.csdn.net/weixin_33857230/article/details/94538085