So I have lots of application data for my application. However, This data does not necessarily need to be backed up to itunes. Where would be the best place to store it?
Asked
Active
Viewed 757 times
1 Answers
2
You can put it in the caches directory
NSArray* cachePathArray = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString* cachePath = [cachePathArray lastObject];
or the temporary directory
NSTemporaryDirectory()
Note that there have been some concerns with iOS 5 as it sometimes clears the caches directory (which previous versions of iOS didn't, current iOS 5.0.1 in beta at the moment aims to solve this). You need to be careful when storing large files to the documents folder in iOS 5
NSArray* documentPathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentPath = [documentPathArray lastObject];
because of big iCloud sync times.
-
Thanks I've been running into the cache directory issue that's why i've come here to ask. Are there any known issues with storing in the temp directory? – endy Nov 07 '11 at 14:57
-
temp directory is going to be cleared when your application quit – Vincent Bernier Nov 07 '11 at 15:01
-
Files in the temp directory can be removed by the system... also. That's the problem, before, developers who wanted to store big files in the app sandbox (without wanting to worry about itunes sync) did so in the cache. Now many are very irritated because they can't guaranty that they will stay there. – jbat100 Nov 07 '11 at 15:02
-
alright thanks for the information. I'll try to keep up to date with 5.0.1. – endy Nov 07 '11 at 15:09