我試圖將一個對象從視圖控制器傳遞給另一個。 在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:終止調用拋出異常
我覺得問題是,我並沒有使用正確的對象
請更新與實際誤差顯示哪些選擇和階級它在抱怨的問題。 –