0

I am working on an application that needs to store some informations locally. I first thought NSUserDefaults is a good way, but i m not very sure. The information i am storing needs to be refreshed once in a while. The server could send me updated and when i receive them i need to refresh the information for the data I ve stored. I could have a lot of different informations and some of them could be refreshed several times in a couple of minutes.

How to do this?

If using a DB - StorageManager when receiving some updated I would have to search in the db for the data i need to update. If I have 40 updated I would have to do 40 select types. It s not too efficient. I currently use a NSUserDefaults with different keys for each information stored. When receiving updates I just search for the particularly key I need and update it.

Once in a while i would also have to check for each data stored locally if it needs to be updated (based on a timer) and if it does..I ask for new updated.

Do you have any other efficient ideas?

just ME
  • 1,817
  • 6
  • 32
  • 53
  • Probably Core Data there are ways to make your select more efficient (i.e. finding items that match a list of criteria in an array for instance). – Fogmeister Jul 03 '14 at 07:22
  • so using core data with an array where to save the data i need to update and than update the information only for that data..would be efficient? – just ME Jul 03 '14 at 07:37
  • Well, it's hard to explain in a comment. But you said to fetch 40 items you would have to do 40 fetches. This is not the case. You can use the predicate format `someProperty IN someArray` and the fetch will fetch all items where the given property exists in the given array. – Fogmeister Jul 03 '14 at 07:53
  • I'd suggest reading up on Core Data though. It's a lot more powerful and performs a lot better than I think you're giving credit for. Marcus Zarra or Ray Wenderlich are good places to start. – Fogmeister Jul 03 '14 at 07:55

0 Answers0