1
我看到它显然可能submit apps without Lion installed,但我的应用程序下载一些大文件,需要根据Apple storage guidelines保存。支持iOS 5.1 NSURLIsExcludedFromBackupKey [不备份]没有安装Lion?
包括下面的代码,我甚至无法编译由于Use of undeclared identifier 'NSURLIsExcludedFromBackupKey'
:
-(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL{
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"5.1")) {
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;
}
}
我怎样才能继续使用此代码,而我只有在Xcode的iOS 5.0 SDK?
(或者是我的愿望没有实际意义,因为我真的不能告诉我的应用程序,它支持的iOS 5.1?)
- (
SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO
来自https://stackoverflow.com/a/5337804/194309)
哈哈是常量的值字面常量的名字只是字符串? –
是的,如果您打印它,在iOS 5.1中,它只是常数的名称。在任何情况下,当ios版本低于5.1时都不会使用它。我可以使用任何价值。 – Lio