我是全新的ios開發,並與我正在嘗試做的打磚牆。ios準備for segue導致崩潰
我在我的方法中有這個代碼,這意味着從這個視圖傳遞一個特定的NSObject到下一個視圖,但它不斷崩潰我的應用程序。
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:@"showPDF"]){
UINavigationController *navController = (UINavigationController *)segue.destinationViewController;
PDFViewController *controller = (PDFViewController *)navController.topViewController;
controller.yourName = self.yourName;
}
我已通過調試並確定它是導致其崩潰的第四行。
輸出:
2015-06-19 11:47:00.955 iOSPDFRenderer[2455:70005] -[PDFViewController topViewController]: unrecognized selector sent to instance 0x7c5375d0
2015-06-19 11:47:00.959 iOSPDFRenderer[2455:70005] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PDFViewController topViewController]: unrecognized selector sent to instance 0x7c5375d0'
*** First throw call stack:
(
0 CoreFoundation 0x01f2b466 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x01bb4a97 objc_exception_throw + 44
2 CoreFoundation 0x01f332c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x01e7bbc7 ___forwarding___ + 1047
4 CoreFoundation 0x01e7b78e _CF_forwarding_prep_0 + 14
5 iOSPDFRenderer 0x000ed00e -[ViewController prepareForSegue:sender:] + 238
6 UIKit 0x00985d77 -[UIStoryboardSegueTemplate _perform:] + 199
7 UIKit 0x00985e05 -[UIStoryboardSegueTemplate perform:] + 116
8 libobjc.A.dylib 0x01bca7cd -[NSObject performSelector:withObject:withObject:] + 84
9 UIKit 0x00368340 -[UIApplication sendAction:to:from:forEvent:] + 99
10 UIKit 0x003682d2 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
11 UIKit 0x0049ca56 -[UIControl sendAction:to:forEvent:] + 69
12 UIKit 0x0049ce73 -[UIControl _sendActionsForEvents:withEvent:] + 598
13 UIKit 0x0049c0dd -[UIControl touchesEnded:withEvent:] + 660
14 UIKit 0x003b8ffa -[UIWindow _sendTouchesForEvent:] + 874
15 UIKit 0x003b9ad5 -[UIWindow sendEvent:] + 791
16 UIKit 0x0037ebb1 -[UIApplication sendEvent:] + 242
17 UIKit 0x0038ebf6 _UIApplicationHandleEventFromQueueEvent + 21066
18 UIKit 0x00362bc7 _UIApplicationHandleEventQueue + 2300
19 CoreFoundation 0x01e4e98f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
20 CoreFoundation 0x01e4449d __CFRunLoopDoSources0 + 253
21 CoreFoundation 0x01e439f8 __CFRunLoopRun + 952
22 CoreFoundation 0x01e4337b CFRunLoopRunSpecific + 443
23 CoreFoundation 0x01e431ab CFRunLoopRunInMode + 123
24 GraphicsServices 0x022da2c1 GSEventRunModal + 192
25 GraphicsServices 0x022da0fe GSEventRun + 104
26 UIKit 0x003669b6 UIApplicationMain + 1526
27 iOSPDFRenderer 0x000ec94d main + 141
28 libdyld.dylib 0x02e58ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
任何一個人有任何想法,這可能是爲什麼?
非常感謝!
你能後墜毀的消息?這是不可能的說什麼 – Miknash
謝謝尼克,我已經添加了消息的問題 – Uberzen1