I am trying to add a bunch of Core Data objects (NSStrings) to NSMutableArray so that I pickerView can use strings as my data values.
Currently, I can save rows from a text field one at a time to the sqlite file in Core Data.
I'm having trouble extracting these objects from the sqlite Core Data file and into the NSMutable array.
This is the code for adding objects to sqlite ...
-(IBAction)addToPicker
{
CoreDataPickerAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context = [appDelegate managedObjectContext];
NSManagedObject *thePerson = [NSEntityDescription insertNewObjectForEntityForName:@"Event" inManagedObjectContext:context];
[thePerson setValue:textField.text forKey:@"eventName"];
[context save:&error];
textField.text=@"";
self.viewDidLoad;
[textField resignFirstResponder];
}
Now I have ...
- (void)viewDidLoad {
NSMutableArray *array = [[NSMutableArray alloc] init];
self.pickerData = array;
[array release];
[super viewDidLoad];
}
Any help would be greatly appreciated. Chris
source
share