Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8509847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:32:42+00:00 2026-06-11T03:32:42+00:00

I have an app with a pre-filled .sqlite file that is copied into the

  • 0

I have an app with a pre-filled .sqlite file that is copied into the user’s Documents directory when the app is first opened. This file is 12.9MB. Twice now, my app has been rejected since changing target to iOS5 with this rejection note:

Binary Rejected Apr 24, 2012 10:12 AM

Reasons for Rejection:

2.23 Apps must follow the iOS Data Storage Guidelines or they will be rejected

Apr 24, 2012 10:12 AM. From Apple.

2.23

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 content download, your app stores 12.81 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

The iOS Data Storage Guidelines indicate that only content that the user creates using your app, e.g., documents, new files, edits, etc., may be stored in the /Documents directory – and backed up by iCloud.

Temporary files used by your app should only be stored in the /tmp directory; please remember to delete the files stored in this location when the user exits the app.

Data that can be recreated but must persist for proper functioning of your app – or because customers expect it to be available for offline use – should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCFURLIsExcludedFromBackupKey attribute.

For more information, please see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?.

It is necessary to revise your app to meet the requirements of the iOS Data Storage Guidelines.

I have tried setting the "do not back up" attribute as recommended in the Data Storage Guidelines, but is was rejected again.

I do not use iCloud in my app, and Settings > iCloud > etc. shows no usage at all.

I cannot use the Caches or tmp directories as the database is modified by the user after creation.

I seem to be between a rock and a hard place here with Apple not allowing this kind of app to function at all.

Has anyone had this problem and managed to overcome it?

EDIT 17-5-12
I still haven’t managed to get this app approved yet. Has anyone managed to do this?

EDIT 1-7-12
My app has just been rejected again for the same reason. I am at a loss as to what to do here, as surely it is a common use scenario.

EDIT 11-9-12
App now approved – please see my solution below. I hope it can help someone else.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:32:44+00:00Added an answer on June 11, 2026 at 3:32 am

    OK, here is the solution I managed to get approved (finally!)

    This is the code for setting the Skip Backup attribute – note that it is different for 5.0.1 and below and 5.1 and above.

    #include <sys/xattr.h>
    - (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
            NSError *error = nil;
            [URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
            return error == nil;
        }
    }
    

    And here is my persistentStoreCoordinator

    - (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
        if (__persistentStoreCoordinator != nil)
        {
            return __persistentStoreCoordinator;
        }
    
        NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"store.sqlite"];
    
        NSError *error;
    
        NSFileManager *fileManager = [NSFileManager defaultManager];
        NSString *storePath = [[[self applicationDocumentsDirectory] path] stringByAppendingPathComponent:@"store.sqlite"];
    
        // For iOS 5.0 - store in Caches and just put up with purging
        // Users should be on at least 5.0.1 anyway
        if ([[[UIDevice currentDevice] systemVersion] isEqualToString:@"5.0"]) {
            NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
            NSString *cacheDirectory = [paths objectAtIndex:0];
            NSString *oldStorePath = [storePath copy];
            storePath = [cacheDirectory stringByAppendingPathComponent:@"store.sqlite"];
            storeURL = [NSURL URLWithString:storePath];
    
            // Copy existing file
            if ([fileManager fileExistsAtPath:oldStorePath]) {
                [fileManager copyItemAtPath:oldStorePath toPath:storePath error:NULL];
                [fileManager removeItemAtPath:oldStorePath error:NULL];
            }
        }
        // END iOS 5.0
    
        if (![fileManager fileExistsAtPath:storePath]) {
            // File doesn't exist - copy it over
            NSString *defaultStorePath = [[NSBundle mainBundle] pathForResource:@"store" ofType:@"sqlite"];
            if (defaultStorePath) {
                [fileManager copyItemAtPath:defaultStorePath toPath:storePath error:NULL];
            }
        }
    
        NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
    
        __persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
        if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error])
        {
            NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
            abort();
        }
    
        [self addSkipBackupAttributeToItemAtURL:storeURL];
    
        return __persistentStoreCoordinator;
    }
    

    Note that I made the decision to just store in Caches and put up with purging for iOS 5.0 users.

    This was approved by Apple this month.

    Please don’t copy and paste this code without reading and understanding it first – it may not be totally accurate or optimised, but I hope it can guide someone to a solution that helps them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have multiple config files (app.DEV.config, app.TEST.config, etc) and a pre-build event that copies
I have an iPhone app that will let users email some pre-determined text as
I have an iOS app that stores some data in a sqlite database. The
I have an app that conducts an interactive exam session for students on pre-configured
I have an Android App with a pre-built SQLite DB packaged with it. However,
we have app hosted on google app engine for java. In this app we
I have app in which i have recorded sound files i want that i
lets say i have app id, app secret id and user uid now i
have an app that finds your GPS location successfully, but I need to be
Have an app that has listings - think classified ads - and each listing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.