The line you wrote won't work that way. I assume contact is the relationship name you have in your Venue entity in xCodeModel.
[venue.contact setValue:textField.text forKey:email]; // can't write this way..
Suppose your ContactInfo
entity has two fields : phone
, email
so this way you can go.
and VenueInfo
entity has two fields : name
.
VenueInfo *venueInfo=[NSEntityDescription insertNewObjectForEntityForName:@"VenueInfo" inManagedObjectContext:self.managedObjectContext];
vanueInfo.name=txtVenueName.text; // venue name entry
ContactInfo *contactInfo=[NSEntityDescription insertNewObjectForEntityForName:@"ContactInfo" inManagedObjectContext:self.managedObjectContext];
contactInfo.phone=txtPhone.text;
contactInfo.email=txtEmail.text;
contactInfo.venue=venueInfo; // I assume venue is the relationship name you give in ContactInfo entity towards Venue entity.
What we did here is we saved phone and email details to ContactInfo
entity only and then we just related it with currently selected VenueInfo
accessing the relationship we declared in ContactInfo
Entity for VenueInfo
.
This maybe quite confusing so I'll recommend you to follow a few tutorials which will give you an idea to grasp some basics about core data relationships.