用户文件夹防止备份到iCloud

//用户文件夹防止备份到iCloud

  • (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL{
    assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);

    NSError *error = nil;
    BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
    forKey: NSURLIsExcludedFromBackupKey error: &error];
    if(!success){
    NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
    }
    return success;
    }

你可能感兴趣的:(用户文件夹防止备份到iCloud)