I have a really big property list file(approximately 2 MB large) and I need to use the data from it in my application. However, it would not be normal to store all the data in some kind of nsdictionary because of its size. I mean something like this:
NSString *path = [[NSBundle mainBundle] pathForResource:@"file" ofType:@"plist"];
someDictionary = [[NSDictionary alloc] initWithContentsOfFile:path];
What would you recommend to get data from this plist or to use instead of plist file.
I would not optimize this before you have profiled your app. Using 2MB of memory sounds like a lot but there are games who load a multiple of that just for sounds and images. If your app is all about that 2MB of data then I think it is totall fine to just load it into memory and use it.
If on the other hand the loading is too slow then you might want to consider using
NSKeyedArchiverandNSKeyedUnarchiverto load your data. They are faster than loading a plist and you can selectively load chunks of the data if you can split it up in logical parts.Another option is of course to use SQLite or Core Data. Those are ideal for ‘tables’ of data. Both can deal with large files.