2012-04-12 108 views
3

我的應用程序已被拒絕,因爲我將應用內購買數據保存在iPhone上的文檔文件夾中。如何使用NSURLIsExcludedFromBackupKey或kCFURLIsExcludedFromBackupKey?

Data that can be recreated but must persist for proper functioning of your app - or because customers expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCFURLIsExcludedFromBackupKey attribute.

但我希望用戶使用的數據,即使他們處於離線狀態,所以我將使用kCFURLIsExcludedFromBackupKeyNSURLIsExcludedFromBackupKey。他們之間有什麼不同?

問題是如何使用它們中的任何一個,它將返回什麼以及如何使用這些返回的數據?

回答

5
NSError *error = nil; 

BOOL result = [fileURL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error]; 
+1

然後我從url中獲取數據通常是?就是這樣..我該如何處理結果? – 2012-04-12 11:24:15

+0

'if(result == NO){NSLog(@「Error:%@」,error); }' – 2012-10-23 11:39:19