Reading basic data as objects


I have 1 entity in my database "Message" with the values MessageID, messageText and i want to read every row of Core Data, make an object of my class "Message" and put the new object into an array. It's the first time I'm using Core Data and I don't quite get it yet, how I manage to do that.

Create a fetch request for the entity you wish to retrieve. Don't give it a predicate, set whatever sort descriptor you want.

Execute the fetch request in a managed object context and it will return an array of all the objects of that entity.

This is purposely just a descriptive answer, you can find the specifics of how to do this from the Core Data introductory documentation; you are new in Core Data and this is a good way to learn it.

Also - don't think of Core Data in terms of rows of data that you turn into objects. It's an Object-Relationship graph. It stores the objects of entities and their relationships between them. You don't turn the "rows" into objects, you get the objects back directly.