Best Method to Store Data for an iOS App

Best method to store data for an iOS app?

If the data you want to store is very little and not sensitive, you can use UserDefaults
For example, user's name, their age etc.

For Large amounts of data you should use Core Data, its a good and an easy way to manage your objects. For example, you have 1000 items, each with a property, you can basically use core data for that. It is pretty straightforward as how to create Managed Objects, store them and how to later retrieve them using queries.

Basically when you configure your project with core data, project creates an sqlite file attached to your project.

There are many tutorials on how to get started with Core Data, if you have an average experience with iOS, it will be a piece of cake for ya.

Here's a nice tutorial that will help you setup core data in your project:

https://www.raywenderlich.com/173972/getting-started-with-core-data-tutorial-2

Best Way to save data locally on the device in iOS app

It sounds as though the text field (with the 1000-2000 words) is static text that is bundled with the app and can not be changed by the user of the app. If that's the case, then you can store that data in the app bundle with plist files, or JSON files and load it on demand (assuming you don't need to search though it).

Then, if each of those records has only a single boolean value that is changeable by the user, those could be stored in NSUserDefaults very easily (since you've stated you're only dealing with 35-40 records). You'd use the id to link the boolean to the data file.

You could use Core Data or Realm to store the data, but it may be overkill if you don't need a search feature and the user can't change the text. But if you do go with a database option, be aware that you can not store static data (the text), in a location that is backed up by iCloud, or Apple will reject your app. Regardless of whether you use iCloud in the app or not. So if you were to create a Core Data persistent store and save it to the users Documents folder, then load in all the static data, you will be rejected. You would want to save that data store in the users Cache folder so that iCloud doesn't back it up. The issue you'll hit after that though is that you want the user's choices that are your boolean values backed up. This means they need to be stored in a different place. Core Data does have a feature that lets you create Configurations where it will separate the user changeable data from the non-changeable data, but again, that's overkill for your case.

I'd recommend starting with Realm over 'Core Data` for such a small dataset. It's much easier to get up and running.

What is the best method to store data for an iPad app

Read this answer about Core Data & sqlite ... https://stackoverflow.com/a/524301/581190 Also you can stick with dictionary serialization (plist, ...). But it's not good idea to use it for larger chunks of data, because serialized dictionaries must be read at once. So, the answer is - go with Core Data, because it's efficient, not a big overhead and it gives you nice object graph management.

Best way to store user information in iOS app

The keychain would not be overkill, that kind of thing is what it's for.

Really though it sounds like a bad security problem in your API. If the user can login and can then access the data of every other user via the API and then if they fiddle with some values, that's no good.



Related Topics



Leave a reply



Submit