如何使用 NSURLIsExcludedFromBackupKey 或 kCFURLIsExcludedFromBackupKey? [英] How to use NSURLIsExcludedFromBackupKey Or kCFURLIsExcludedFromBackupKey?

查看:44
本文介绍了如何使用 NSURLIsExcludedFromBackupKey 或 kCFURLIsExcludedFromBackupKey?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用被拒绝,因为我将应用内购买数据保存在 iPhone 上的 Documents 文件夹中.

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

可以重新创建但必须保留以保证您的应用正常运行的数据(或者因为客户希望它可用于离线使用)应标记为不备份"属性.对于 NSURL 对象,添加 NSURLIsExcludedFromBackupKey 属性以防止备份相应的文件.对于 CFURLRef 对象,使用相应的 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.它们之间有什么不同?

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?

推荐答案

NSError *error = nil;

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

这篇关于如何使用 NSURLIsExcludedFromBackupKey 或 kCFURLIsExcludedFromBackupKey?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆