App Store Rejection - iCloud Backup Exclusion

184 views
Skip to first unread message

Mike Platt

unread,
Jun 12, 2013, 2:24:51 AM6/12/13
to mobile-c...@googlegroups.com
An update for my app running CBL just got rejected from the store for the following reason:

"In particular, we found that on launch and/or content download, your app stores 12.08 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., should be backed up by iCloud. "

The following code is the Apple suggestion as to how to stop data being included in the iCloud Backup...

- (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;
}

Firstly has anyone else had this problem?

Secondly has anyone implemented this code on CDL databases? (I am not sure where to point the URL).

Thanks in advance.

Mike

Jens Alfke

unread,
Jun 12, 2013, 2:45:54 AM6/12/13
to mobile-c...@googlegroups.com

On Jun 11, 2013, at 11:24 PM, Mike Platt <mike...@inbox.com> wrote:

Secondly has anyone implemented this code on CDL databases? (I am not sure where to point the URL).

The CBLManager.directory property returns the path to the root directory where databases are stored. From a database you’d access it like `database.manager.directory`.

As an alternative to using that code, you can instantiate the CBLManager with a directory path that points to some location that isn’t subject to backup. I can’t remember what the best location like this is — but you probably don’t want to use the Caches directory because anything in there might be nuked by the OS to free up storage, even if you haven’t synced changes up to the server yet.

—Jens

Ragu Vijaykumar

unread,
Jul 10, 2014, 3:15:11 PM7/10/14
to mobile-c...@googlegroups.com
I know this thread is a bit old, but I thought I would resurrect it. I also just submitted my app to the app store, and was rejected for the same reason. The app comes with a couple of databases, and on launch uses the CBLManager move mechanism and places those databases in the Application Support directory where all the CBL databases are. I store no data in my Documents directory during the lifetime of the app. Did anyone else have this problem? Did you resolve it via the code in this old thread, or some other mechanism?

Any help would be greatly appreciated!

Jens Alfke

unread,
Jul 10, 2014, 3:45:13 PM7/10/14
to mobile-c...@googlegroups.com

On Jul 10, 2014, at 12:15 PM, Ragu Vijaykumar <ra...@scrxpt.com> wrote:

I know this thread is a bit old, but I thought I would resurrect it. I also just submitted my app to the app store, and was rejected for the same reason. The app comes with a couple of databases, and on launch uses the CBLManager move mechanism and places those databases in the Application Support directory where all the CBL databases are. I store no data in my Documents directory during the lifetime of the app.

The App Support directory is backed up too.

There are three things you can do:
  • Store your databases in some other location that isn’t backed up. CBLManager has an initializer method that lets you override what directory it uses.
  • Mark the manager’s directory as not to be backed up, by setting the NSURLIsExcludedFromBackupKey attribute.
  • Cherry-pick commit 4d96a8b and set the CBLManager.excludedFromBackup property to YES.

—Jens

Ragu Vijaykumar

unread,
Jul 10, 2014, 4:24:30 PM7/10/14
to mobile-c...@googlegroups.com
Oh interesting, I didn't know that. Hmm, is it possible to store some databases in different locations than other databases? Can I have my user database in Application Support/Couchbase, but the other databases in Application Support/Other and mark the Other directory as to be excluded? 

Do I have to create different CBLManagers, one for each directory, or can I used the sharedInstance CBLManager to manage databases in different directories?

Jens Alfke

unread,
Jul 10, 2014, 4:43:25 PM7/10/14
to mobile-c...@googlegroups.com

On Jul 10, 2014, at 1:24 PM, Ragu Vijaykumar <ra...@scrxpt.com> wrote:

Oh interesting, I didn't know that. Hmm, is it possible to store some databases in different locations than other databases? Can I have my user database in Application Support/Couchbase, but the other databases in Application Support/Other and mark the Other directory as to be excluded? 

No, they’re all in the same parent directory. You can mark individual databases as being excluded from backup by setting that attribute on them. Unfortunately a database doesn’t have a single parent directory, but instead has four files you’ll need to set the attribute on:
foo.cblite
foo.cblite-wal
foo.cblite-shm
foo attachments/
Ordinarily you shouldn’t mess with the individual files in the CouchbaseLite directory, but there isn’t a good alternative for this.

—Jens

Ragu Vijaykumar

unread,
Jul 10, 2014, 7:54:35 PM7/10/14
to mobile-c...@googlegroups.com
Ah ok, thanks for the information. I'll resubmit it then with the excludedFromBackup parameter turned on then.

Cheers
Reply all
Reply to author
Forward
0 new messages