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

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

问题描述

在我的应用程序,我有存储核心数据的数据库和音频文件,所以我去codeD把它们放在Documents目录。
若要从备份,当我第一次启动应用程序prevent他们,我把在不要备份标志像这样

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:

我们发现,您的应用程序不遵循iOS的数据存储的准则,这是每个在App Store审查指南要求。

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的,你不应该把不要备份标志
不要将备份的标志是在IOS 5.0.1介绍
我们也面临着相似的问题与我们的应用程序,它已被拒绝了几次
因此,我们必须做一个变通处理不同iOSes
我们需要支持的iOS&LT; 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

所以苹果接触后,我们没有找到任何解决方案,除了有不同的iOSes不同路径

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

我们有这样的功能:

+ (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版将删除你的文件
  从必要时缓存目录,所以您的应用程序将需要
  优雅降级,如果它的数据文件被删除。

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.

<一个href=\"http://developer.apple.com/library/ios/#qa/qa1719/_index.html\">http://developer.apple.com/library/ios/#qa/qa1719/_index.html

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

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