应用程序不存储在文件目录中的任何内容,但苹果商店拒绝 [英] App does not store any content in document directory but Appstore reject

查看:196
本文介绍了应用程序不存储在文件目录中的任何内容,但苹果商店拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的iOS开发。我的应用得到了来自检讨拒绝,载明下列原因,

I am new to iOS development. My app got rejected from the review, stating the following reason,

2.23应用程序必须遵循的iOS数据存储的准则,否则将被拒绝。

2.23 Apps must follow the iOS Data Storage Guidelines or they will be 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.

我不存储文档目录我的数据库文件。这里是我的code,

I am not storing my DB file in documents directory. Here's my code,

NSString *libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
NSString *path = [libraryPath stringByAppendingPathComponent:@"DatabaseFolder"];
NSURL *pathURL = [NSURL fileURLWithPath:path];
BOOL isDirectory = NO;
if ([[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]) {
    if (isDirectory) {
        return pathURL;
    } else {
        // Handle error. ".data" is a file which should not be there...
        [NSException raise:@"'Private Documents' exists, and is a file" format:@"Path: %@", path];
    }
}
NSError *error = nil;
if (![[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error]) {

    [NSException raise:@"Failed creating directory" format:@"[%@], %@", path, error];
}
return pathURL;

如何重现崩溃或错误,只有应用程序审查或用户所看到的?

How to reproduce a crash or bug that only App Review or users are seeing?

推荐答案

借助的iOS数据存储纲领性文件(需要登录查看)说,

The iOS Data Storage guideline document (login required to view) says,

在您的应用程序的主目录一切都被备份,随着应用的例外捆绑本身,缓存目录和临时目录。

Everything in your app’s home directory is backed up, with the exception of the application bundle itself, the caches directory, and temp directory.

这意味着即使你的 NSLibraryDirectory 目录内容被备份到iCloud。要解决这一点,你有以下选项,

This means even your NSLibraryDirectory directory contents gets backed up to iCloud. To resolve this you have following options,


  • 使用/ tmp目录中存储

  • 使用/缓存目录中存储

  • 仅用于无法重新创建用户生成的内容/ Documents目录。

  • 将不备份属性使用setResourceValue文件:forKey:错误:NSURL的方法

下面是你可以标记为未备份到iCloud的资源。

Here is how you can mark a resource for not backing up to iCloud.

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
    assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);

    NSError *error = nil;
    BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
                              forKey: NSURLIsExcludedFromBackupKey error: &error];
    if(!success){
        NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
    }
    return success;
}

希望帮助!

这篇关于应用程序不存储在文件目录中的任何内容,但苹果商店拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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