检测文件是否存在于沙盒中

    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *documentPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];
    NSString* tempstr = [documentPath stringByAppendingPathComponent:@"menu.plist"];
    if (![fileManager fileExistsAtPath:tempstr]) {//如果指定目录不存在该文件
        NSString *defaultpath = [[NSBundle mainBundle]pathForResource:@"menu" ofType:@"plist"];
        if (defaultpath) 
{ [fileManager copyItemAtPath:defaultpath toPath:tempstr error:NULL];//拷贝文件 从一个路径拷贝到另一个路径 } }
原文地址:https://www.cnblogs.com/gaoxiao228/p/2455415.html