For example. if I have a chat app that uses objects like: ChatRoom and ChatMessage. (both subclasses of NSManagedObject)
And throughout the app I need to: search chat rooms / add massages / create chat rooms and messages / and any other manipulate.
Is it ok if I do everything directly with core data? I mean every time I need to search a chat room or something like that, to do it with NSFetchRequest or NSFetchedResultsController.
For example. if I have a chat app that uses objects like: ChatRoom and
Share
You can access the data whenever you need, of course. On the other hand you should try to use caching mechanism as much as possible.
For example, if you are using your data in
UITableViewyou should defintely go withNSFetchedResultsControlleras it was created explicitly forUITableViews. From the apple docs onNSFetchedResultsController:Otherwise, if you need the data just temporarily, you can access them of course using
NSFetchRequesteach time they are needed or cache them in your business objects if they don’t change or you know their lifetime otherwise.