Hi, i need to store an array of 40000 statics strings ( towns ).
how can i do this in objective C ?
Thanks, JP
Hi, i need to store an array of 40000 statics strings ( towns ).
how can i do this in objective C ?
Thanks, JP
Personally I'd use CoreData and have the bits of data I need read in when they are needed. The other option would be to store it all in memory using NSDictionary but that would potentially require the user to have a fair amount of memory.
The CoreData approach will give you a decently fast way of retrieving the town names but if speed is key and memory usage doesn't matter then using something like NSDictionary or NSArray would be the faster solution.
I gave a point to both James and Chuck as both answers are correct given the lack of context.
The meta-question is what are you trying to do?
If you are just trying to show a list of cities and not actually building up a data model, then Chuck's answer is quite appropriate. 3,000 cities in NSString's in an NSArray is really not that much.
However, I'd bet you are doing more than that. I would be surprised if you weren't building up some kind of data model where the cities are connected to the data model, even a small portion of that. In that case, James's answer is correct; CoreData is the way to go as it will be plenty of fast, highly scalable, and offers you with higher level tools for modeling and interacting with your data.