ビュー コントローラーから別のビュー コントローラーにオブジェクトを渡そうとしています。私が持っているdestinationControllerで:
@interface destinationController : UITableViewController{
destinationController *object;
@property(nonatomic,copy) destinationController *object;
私が持っている情報を含むviewControllerで:
- (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];
vcArray には数字と名前が含まれていますが、選択した行のみが必要です。選択したオブジェクトを destinationController のオブジェクトに渡そうとしてもうまくいかないようです。代わりに、次のエラーが表示されます。
[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