因为工程中文件存储路径设置有误,导致有大文件同步到iCloud,造成审核被拒,解决方法除了修改存储路径外,还可以设置忽略数据同步的文件目录,在AppDelegate.m中调用一下方法即可。
+ (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *)filePathString
{
NSURL* URL= [NSURL fileURLWithPath: filePathString];
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);
} else {
NSLog(@"Secceed excluding %@ from backup %@", [URL lastPathComponent], error);
}
return success;
}
方法参数即文件夹或文件的沙盒路径。