I'm making an app with a list of the products of a company. The data does not need to be modified by the user. How can I save this information? The data must already exist locally when you download the app.
-
plist vs core data vs NSUserDefaults- http://stackoverflow.com/a/7059445/1692651. Another option is Realm - https://github.com/realm/realm-cocoa – Martin Makarsky Jan 13 '16 at 13:27
-
Very little research was done when asking this question. – Ashley Mills Jul 27 '18 at 20:45
3 Answers
You can go with either NSUserdefaults or CoreData, additionally there is a third party library called Realm.
Also check this question: storing data locally on the iphone
Edit The answer was provided by Sr.Richie in the link:
For simple data you should use NSUserDefaults. CoreData is very cool but mainly to store DB structures, and introduces complexity (but i love it:)). If you just need to store String, Array and so on (basically prefs), you can go with NSUserDefaults:
For example:
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; //load NSUserDefaults
NSArray *fakeFavs = [[ NSArray alloc] initWithObjects:@"2",@"4", @"100", nil]; //declare array to be stored in NSUserDefaults
[prefs setObject:fakeFavs forKey:@"favourites"]; //set the prev Array for key value "favourites"
As per your requirement Plist or SQLite is good option for you.
Why Plist
Because it is lightweight.
Why SQLite
If you want to perform query on your data.

- 1,539
- 15
- 37
You can save the data in sqlite or coredata. For already filling the data in database you can use "sqlite manager" and run your queries in sqlite manager and save it on desktop(where you want). After create the filled database drag it into your project and do whatever your want. You have already filled database here.

- 19
- 2