Is there a way to exclude some of the files in your application bundle from being backed up to the user's computer? I have a photo browsing application that allows you to store photos/videos locally, when a user goes sync their device and the application is backed up its taking a really long time since its backing up all the locally stored photos/videos as well. Is there perhaps a directory (/tmp/?) that won't be backed up?
+4
A:
Yes you must put files that you don't want to backup to Caches directory. Path can be obtained:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachesPath = [paths objectAtIndex:0];
Vladimir
2010-07-20 17:07:32
While this is the way to go in your situation @Shizam don't just do it blindly. Read the links in @Franci Penov's answer before doing so. Its crucial to understand the roles and issues that effects each directory that you can use.
jamone
2010-07-20 19:16:15
Thanks, this is great and I'm reading through those docs to make the best decision on where to store stuff. Marking this as the answer as it came in 1st.
Shizam
2010-07-20 20:35:44
+2
A:
iOS Applocation Programming Guide: A Few Important Application Directories talks about which folders are backed up and which aren't. You should use <Application_Home>/Library/Caches
to store persistent data that does not need to be backed up.
iPhone Application Programming Guide: Getting Paths to Application Directories shows how to get the path to that folder by using NSSearchPathForDirectoriesInDomains
with NSCachesDirectory
parameter.
Franci Penov
2010-07-20 17:33:57
+2
A:
/Library/Caches is not guaranteed to be kept during application updates. This could be a problem for your media files.
James Chen
2010-08-30 15:04:28