Apple第二次拒绝了我的应用程序

时间:2014-10-21 08:18:57

标签: ios iphone backup data-storage

我创建了一个应用程序,并且苹果拒绝两次不遵循ios数据存储指南,我很惊讶因为我已经提交了应用程序而没有任何问题,我使用sqlite来存储我的数据,我将图像存储到文档目录中和他们进入数据库的路径,我已经做了什么

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
    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;
}

-(void) copyDatabaseIfNeeded {

    //Using NSFileManager we can perform many file system operations.
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error;
    NSString *dbPath = [self getDBPath];
    BOOL success = [fileManager fileExistsAtPath:dbPath];

    if(!success) {
        NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:databaseName];
        success = [fileManager copyItemAtPath:defaultDBPath toPath:dbPath error:&error];

        [self addSkipBackupAttributeToItemAtURL:[NSURL URLWithString:dbPath]];

        if (!success)
            NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);
    }
}

-(void)connectWithDB
{
    [self copyDatabaseIfNeeded];
    [self generateDB];
}

在我的booldidfinishWithLaunchingOption函数中我做了

[self connectWithDB];

我不知道为什么他们有问题,

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

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

Install and launch your app
Go to Settings > iCloud > Storage & Backup > Manage Storage
If necessary, tap "Show all apps"
Check your app's storage

1 个答案:

答案 0 :(得分:2)

您使用的是旧方法。使用this document

中描述的较新方法
- (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;
}