我在使用“SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO”检查操作系统版本时遇到错误,我的应用程序是在旧操作系统工具中开发的。所以我改成这个,替换为“SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO”
double currSysVer =[[[UIDevice currentDevice] systemVersion] doubleValue];
if (currSysVer>=5.1) {
NSError *error = nil;
//[URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
[URL setResourceValue:[NSNumber numberWithBool:YES] forKey:@"NSURLIsExcludedFromBackupKey" error:&error];
return error == nil;
}else{
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}