不要备份到 iCloud 但仍然被拒绝 [英] Don't Backup to iCloud but still rejected

查看:34
本文介绍了不要备份到 iCloud 但仍然被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我必须存储核心数据数据库和音频文件,所以我解码后将它们放在 Documents 目录中.为了防止他们备份,当我第一次启动应用程序时,我把不要备份这样的标志

In my app i have to store Core Data Database and audio files, so i decoded to put them in Documents directory. To prevent them from backing up, when i first launch the app, i put the 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];
  }
}

但它似乎不起作用 - 我仍然被拒绝:

But it seems like it doesn't work - i still get rejected:

我们发现您的应用不符合 App Store 审核指南所要求的 iOS 数据存储指南.

We found that your app does not follow the iOS Data Storage Guidelines, which is required per the App Store Review Guidelines.

特别是,我们发现在发布和/或内容下载时,您的应用商店 3.6 MB.要检查您的应用存储了多少数据:

In particular, we found that on launch and/or content download, your app stores 3.6 MB. To check how much data your app is storing:

  • 安装并启动您的应用
  • 前往设置">iCloud">存储与存储"备份 > 管理存储
  • 如有必要,请点按显示所有应用"
  • 检查应用的存储空间

另一个问题是我无法检查 - 我在

And the other problem is that i just can't check that - i don't see my app in

设置 > iCloud > 存储&备份 > 管理存储

Settings > iCloud > Storage & Backup > Manage Storage

也许只有 5.0 的问题是我在这里没想到的?

Maybe the problem is only with 5.0 that i kind of not think about here?

推荐答案

问题在于 iOS 5.0,在这个 iOS 中你不应该放置 dont backup 标志ios 5.0.1 中引入了不备份标志我们的应用程序确实遇到了类似的问题,它已被多次拒绝所以我们不得不做一些工作来处理不同的 iOS我们需要支持 iOS <5.0、iOS 5.0 和 iOS > 5.0

The problem is with iOS 5.0, in this iOS you should not put the dont backup flag The dont back up flag was introduced in ios 5.0.1 We did face similar problem with our app, it has been rejected several times So we had to do a work around to handle different iOSes We needed to support iOS < 5.0, iOS 5.0, and iOS > 5.0

所以联系了apple之后,除了在不同的iOS上有不同的路径,我们没有找到任何解决办法

So after contacting apple, we didnt find any solution except to have different paths on different iOSes

我们有一个这样的函数:

We had a function like this:

+ (NSString*) savePath
{
    NSString *os5 = @"5.0";

    NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
    NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];

    if ([currSysVer compare:os5 options:NSNumericSearch] == NSOrderedAscending) //lower than 4
    {
        return path;
    }
    else if ([currSysVer compare:os5 options:NSNumericSearch] == NSOrderedDescending) //5.0.1 and above
    {        
        return path;
    }
    else // IOS 5
    {
        path = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];
        return path;
    }

    return nil;
}

我们使用过并且仍在使用此功能.

We used and still use this function.

请阅读更多

iOS 5.0

无法从 iOS 5.0 的备份中排除数据.如果你的应用程序必须支持iOS 5.0,然后您需要将您的应用程序数据存储在缓存以避免数据被备份.iOS 将删除您的文件必要时从 Caches 目录中,因此您的应用程序需要如果它的数据文件被删除,则优雅地降级.

It is not possible to exclude data from backups on iOS 5.0. If your app must support iOS 5.0, then you will need to store your app data in Caches to avoid that data being backed up. iOS will delete your files from the Caches directory when necessary, so your app will need to degrade gracefully if it's data files are deleted.

http://developer.apple.com/library/ios/#qa/qa1719/_index.html

这篇关于不要备份到 iCloud 但仍然被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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