【发布时间】:2012-06-09 02:44:50
【问题描述】:
在我的应用程序中,我必须存储核心数据数据库和音频文件,所以我将它们解码以将它们放在 Documents 目录中。 为了防止他们备份,当我第一次启动应用程序时,我把 Don't BackUp flag like this
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self addSkipBackupAttributeToItemAtURL:[self applicationDocumentsDirectory]];
}
- (NSURL *)applicationDocumentsDirectory
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
if (&NSURLIsExcludedFromBackupKey == nil) { // iOS <= 5.0.1
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;
} else { // iOS >= 5.1
return [URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:nil];
}
}
但它似乎不起作用 - 我仍然被拒绝:
我们发现您的应用未遵循 App Store 审核指南所要求的 iOS 数据存储指南。
特别是,我们发现在发布和/或内容下载时,您的 应用商店 3.6 MB。要检查您的应用存储了多少数据:
- 安装并启动您的应用
- 转到设置> iCloud > 存储和备份> 管理存储
- 如有必要,请点按“显示所有应用”
- 检查应用的存储空间
另一个问题是我无法检查 - 我没有在
中看到我的应用设置 > iCloud > 存储和备份 > 管理存储
也许问题只出在我这里没有考虑的 5.0 上?
【问题讨论】:
-
为什么要“关闭”投票?这个问题绝对不是题外话。
标签: objective-c ios app-store storage icloud