How to use NSURLIsExcludedFromBackupKey Or kCFURLIsExcludedFromBackupKey?

只愿长相守 提交于 2019-12-07 13:24:43

问题


My App had been rejected because I save in-app purchase data in Documents folder on iPhone.

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.

But I want the user to use the data even if they are offline, so I'll use kCFURLIsExcludedFromBackupKey or NSURLIsExcludedFromBackupKey. What is the different between them?

The question is how to use any of them, and what will it return and how can I use this returned data?


回答1:


NSError *error = nil;

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


来源:https://stackoverflow.com/questions/10121165/how-to-use-nsurlisexcludedfrombackupkey-or-kcfurlisexcludedfrombackupkey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!