I am trying to pass an object from a view controller to another one. In the destinationController I have:
@interface destinationController : UITableViewController{
destinationController *object;
@property(nonatomic,copy) destinationController *object;
In the viewController containing the information I have:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
[self performSegueWithIdentifier:@"destinationController" sender:self];
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([[segue identifier] isEqualToString:@"destinationController"])
{
destinationController *dC =[segue destinationViewController];
NSInteger selected = [[self.tableView indexPathForSelectedRow] row];
dC.object=[vcArray objectAtIndex:selected];
where the vcArray contains numbers and names but I only want the selected row. Trying to pass the selected object to the object in destinationController does not seem to work. Instead it gives me the error:
[viewController copyWithZone:]: unrecognized selector sent to instance 0x8000140 2012-11-14 18:08:25.039 app[3314:13d03] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[viewController copyWithZone:]: unrecognized selector sent to instance 0x8000140'* First throw call stack: (0x18e6012 0x12abe7e 0x19714bd 0x18d5bbc 0x18d594e 0x12a8cc9 0x83b2 0x5c22 0x63aac7 0x2d5422 0x5a68 0x2a28d5 0x2a2b3d 0xca9e83 0x18a5376 0x18a4e06 0x188ca82 0x188bf44 0x188be1b 0x1dae7e3 0x1dae668 0x1f365c 0x1f4d 0x1e75) libc++abi.dylib: terminate called throwing an exception
I think the problem is that I am not assigning properly the object