我正在尝试从场景中解脱出来。它工作正常,但我需要为父屏幕获取一个值。 (我使用 push segue 从父场景导航到子场景)
我是这样称呼放松转场
- (IBAction)doneUIStoryboardSegue *)segue {
NSLog(@"gonna navigate");
RESTToppingTableViewController *vc = [segue destinationViewController];
[self setSelectedToppings:[vc toppingList]];
NSLog(@"%@", [vc toppingList]);
}
但问题是,似乎 toppingList
数组甚至在调用父 View 之前就已从内存中删除。
以下是我得到的错误。
2013-12-06 13:26:42.192 Pizza to Go[2319:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RESTAddToCartViewController toppingList]: unrecognized selector sent to instance 0x9b681a0'
*** First throw call stack:
(
0 CoreFoundation 0x01f405e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01cc38b6 objc_exception_throw + 44
2 CoreFoundation 0x01fdd903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01f3090b ___forwarding___ + 1019
4 CoreFoundation 0x01f304ee _CF_forwarding_prep_0 + 14
5 Pizza to Go 0x0004a3a2 -[RESTAddToCartViewController done:] + 130
6 libobjc.A.dylib 0x01cd581f -[NSObject performSelector:withObject:] + 70
7 UIKit 0x010d01f1 -[UIStoryboardUnwindSegueTemplate _perform:] + 536
8 UIKit 0x00f660f9 -[UIStoryboardSegueTemplate perform:] + 115
9 libobjc.A.dylib 0x01cd5874 -[NSObject performSelector:withObject:withObject:] + 77
10 UIKit 0x00a330c2 -[UIApplication sendAction:to:from:forEvent:] + 108
11 UIKit 0x00d07c9b -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 139
12 libobjc.A.dylib 0x01cd5874 -[NSObject performSelector:withObject:withObject:] + 77
13 UIKit 0x00a330c2 -[UIApplication sendAction:to:from:forEvent:] + 108
14 UIKit 0x00a3304e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
15 UIKit 0x00b2b0c1 -[UIControl sendAction:to:forEvent:] + 66
16 UIKit 0x00b2b484 -[UIControl _sendActionsForEvents:withEvent:] + 577
17 UIKit 0x00b2a733 -[UIControl touchesEnded:withEvent:] + 641
18 UIKit 0x00a7051d -[UIWindow _sendTouchesForEvent:] + 852
19 UIKit 0x00a71184 -[UIWindow sendEvent:] + 1232
20 UIKit 0x00a44e86 -[UIApplication sendEvent:] + 242
21 UIKit 0x00a2f18f _UIApplicationHandleEventQueue + 11421
22 CoreFoundation 0x01ec983f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
23 CoreFoundation 0x01ec91cb __CFRunLoopDoSources0 + 235
24 CoreFoundation 0x01ee629e __CFRunLoopRun + 910
25 CoreFoundation 0x01ee5ac3 CFRunLoopRunSpecific + 467
26 CoreFoundation 0x01ee58db CFRunLoopRunInMode + 123
27 GraphicsServices 0x03e159e2 GSEventRunModal + 192
28 GraphicsServices 0x03e15809 GSEventRun + 104
29 UIKit 0x00a31d3b UIApplicationMain + 1225
30 Pizza to Go 0x000574ad main + 141
31 libdyld.dylib 0x0285e725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
可能的解决方法是什么?提前感谢您的宝贵时间。
我不确定,但我认为您的 destinationViewController
不是 RESTToppingTableViewController
。
日志:
-[RESTAddToCartViewController toppingList]:
unrecognized selector sent to instance 0x9b681a0
表示您正在尝试获取 RESTAddToCartViewController
的 toppingList,但此 Controller 没有 toppingList 属性。
确保 [segue destinationViewController]
返回的 UIViewController
确实是您所期望的。
关于ios - 导航回父场景时展开 segue 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20418923/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |