我试图将一个对象从视图控制器传递给另一个。 在destinationController我:使用segue的xcode传递对象
@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:]:无法识别的选择发送到实例0x8000140 2012年11月14日18:08:25.039的应用[3314:13d03] *终止应用程序由于未捕获的异常“NSInvalidArgumentException ”,原因: ' - [的viewController copyWithZone:]:无法识别的选择发送到实例0x8000140' *第一掷调用堆栈: (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:终止调用抛出异常
我觉得问题是,我并没有使用正确的对象
请更新与实际误差显示哪些选择和阶级它在抱怨的问题。 –