Wednesday 15 June 2011

ios - Magical record 1 to many relationships objective c -


I am using the Xcode for the database I have two entities, one is named 'work' and another There is a 'comment', I want to make a relationship so that I ask a question for a task, when possible, I am new to magical records, hope that I explained this problem. Thank you.

Edit: Hey, thanks for your help, I put this code into a task:

  NSManagedObjectContext * localContext = [NSManagedObjectContext MR_defaultContext]; TerephaMR * Task = [TerafMR MR_CatteryContacts: Local CONTACT]; Work. // ... (Commented in Nassxide * [Tarefah ObjectForekey: @ "comments"]) {NSMOJOBoxTextNextContactS 3 = [NSMGObGsTextMr_DefaultContains]; CommentRRR * Comment = [ComentioRR MR_CatteryContacts: LocalContacts3]; [Localintex 3mr_servicestentstore endwight]; [Work addComentariosObject: Comment]; } [Local contact MR_saveToPersistentStoreAndWait];   

But now I try to access it and I feel that no comment was received from the work,

I used the code: [TREPHA MR MR_FINDEL] in TERAFRA MR * TERIFA for the

 ;) {NSLog (@ "Tarefa Cotentros% @", Tarefa Cotentros); }   

let me have a

tarefa.comentarios relationship 'related comentarios' on the related object: comentarios =;

I was already trying to loop tarfa queteiro, but nothing found, if I ask the database to comment, then the objects are present.

Then I tried to use:

 for  (commentaryio MR * Terafecha Contrarenos in Comment) {NSLog (@ "Comment list header% @", comment. List header); NSLog (@ "Comment List Text% @", comment.listText); }   

How can I get a comment on the job?

Magical record is just a wrapper around the core data You can use your core data model editor in Xcode Define the institutions and their relationships. You can use this tool by clicking on the file named [.xcdatamodeld] in your Xcode [name of your project]. If you do not have such a file, you need to first create one.

In this visual editor you can create institutions and add attributes and relationships for them. You can then choose one of your relationships, go to the inspector in the xcode which has been presented by a little database and tick on the 'to-multiple relationship' box.

If you do not know the core data works, I urge you to read or at least find some tutorials that show how it works.

No comments:

Post a Comment