objective c - ios prepare for segue causing crash -


i'm brand new ios development , have hit brick wall trying do.

i have code in method meant pass on specific nsobject view next view, keeps crashing app.

-(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; } 

i have debugged through , have identified fourth line causing crash.

output:

2015-06-19 11:47:00.955 iospdfrenderer[2455:70005] -[pdfviewcontroller topviewcontroller]: unrecognized selector sent instance 0x7c5375d0 2015-06-19 11:47:00.959 iospdfrenderer[2455:70005] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[pdfviewcontroller topviewcontroller]: unrecognized selector sent 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 uncaught exception of type nsexception 

does 1 have ideas why be?

many thanks!

from error log , code think don't have navigation controller @ top. try following:

-(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender{     if([segue.identifier isequaltostring:@"showpdf"]){         pdfviewcontroller *controller = (pdfviewcontroller *))segue.destinationviewcontroller;         controller.yourname = self.yourname;     } } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -