I used basic data to configure all my objects. But when I try to create a new client object and send it to the addCustomer view module controller, I keep getting this error.
* Application termination due to an uncaught exception 'NSInvalidArgumentException', reason: '- [UINavigationController setCustomer:]: unrecognized selector sent to instance 0x8854700'
The error occurs in AccountListTableViewController.m when the program receives addController.customer = newCustomer in the prepareForSegue file.
Here is the code:
AccountListTableViewController.h
AccountListTableViewController.m
#import "AccountListTableViewController.h" #import "AccountListCell.h" #import "Customer.h" #import "AppDelegate.h" @implementation AccountListTableViewController @synthesize managedObjectContext, fetchedResultsController; - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if ([[segue identifier] isEqualToString:@"AddAccountSegue"] ) { CustomerAddViewController *addController = [segue destinationViewController]; addController.delegate = self; Customer *newCustomer = [NSEntityDescription insertNewObjectForEntityForName:@"Customer" inManagedObjectContext:self.managedObjectContext]; addController.customer = newCustomer; } } -(void)customerAddViewController:(CustomerAddViewController *)customerAddViewController didAddCustomer:(Customer *)customer{ [self dismissModalViewControllerAnimated:YES]; } - (id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) {
CustomerAddViewController.h
CustomerAddView.m
#define NAME 0 #define ADDRESS 1 #define CONTACT 2 #import "CustomerAddViewController.h" #import "Customer.h" @implementation CustomerAddViewController @synthesize firstName, lastName, address, city, state, zip, homePhone, cellPhone, email, customer, delegate;
source share