ios - Not Able to Push UIViewController -


i'm having issue ui refreshing when go push view controller. here's i'm doing...

so, when push notification received app, didreceiveremotenotification method called appdelegate , following executed:

uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil];                  receiptviewcontroller *rv;                  if(screenheight == 480)                 {                     rv = [storyboard instantiateviewcontrollerwithidentifier:@"receiptview2"];                 }else{                     rv = [storyboard instantiateviewcontrollerwithidentifier:@"receiptview"];                 }                 //receiptviewcontroller *rv = [storyboard instantiateviewcontrollerwithidentifier:@"receiptview"];                  rv.orderid = userinfo[@"orderid"];                 rv.driverid = userinfo[@"driverid"];                 rv.cost = [userinfo[@"cost"] intvalue];                  [(uinavigationcontroller *)self.window.rootviewcontroller pushviewcontroller:rv animated:yes]; 

so here ^, i'm redirecting viewcontroller depending on screen size (3.5 inch or 4 inch). works fine.

in receiptviewcontroller however, i've got button following action:

uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil];     pickupviewcontroller *pv;      if(screenheight == 480)     {         nslog(@"---------------------------i'm @ 480 height!!!---------------------------");          pv = [storyboard instantiateviewcontrollerwithidentifier:@"pickupview2"];     }else{          nslog(@"---------------------------i'm @ 568 height!!!---------------------------");          pv = [storyboard instantiateviewcontrollerwithidentifier:@"pickupview"];     }        nslog(@"-------------------going pickupviewcontroller!!!!-------------------");      [self.navigationcontroller pushviewcontroller:pv animated:yes]; 

now here's weird part. when button tapped , above block of code executed, init method in pickupviewcontroller run (i know because i'm seeing nslog come it), still see receiptviewcontroller. responsive though though it's still on receiptviewcontroller. not sure i'm doing wrong here. appreciated!

-----------edit---------------------

i should mention happens in appdelegate method when push receiptviewcontroller in didreceiveremotenotification method (when receive push notification). if exact same thing in appdelegate's applicationwillenterforeground, exact same parameters being passed receiptviewcontroller, works fine.

-----------update---------------------

so ran following when button tapped:

nsuinteger countviews = [self.navigationcontroller.viewcontrollers count];     nsstring *currentselectedviewcontroller = nsstringfromclass([[self.navigationcontroller visibleviewcontroller] class]);      nslog(@"---------------------------current viewcontroller => %@, total viewcontrollers on navcontroller => %tu", currentselectedviewcontroller, countviews); 

i'm getting correct name of viewcontroller & says stack count 7. not sure what's going on here... i'm referencing right navigation controller & it's not null. if like:

[self.navigationcontroller poptorootviewcontrolleranimated:yes]; 

i'm getting exc_crash (sigabrt)

thread 0 crashed: 0   libobjc.a.dylib                 0x0000000196c181d0 objc_msgsend + 16 1   uikit                           0x000000018d6fd040 -[uiapplication sendaction:totarget:fromsender:forevent:] + 20 2   uikit                           0x000000018d6e651c -[uicontrol _sendactionsforevents:withevent:] + 372 3   uikit                           0x000000018d6fca40 -[uicontrol touchesended:withevent:] + 580 4   uikit                           0x000000018d6fc6d4 -[uiwindow _sendtouchesforevent:] + 688 5   uikit                           0x000000018d6f736c -[uiwindow sendevent:] + 1168 6   uikit                           0x000000018d6c8b4c -[uiapplication sendevent:] + 252 7   uikit                           0x000000018d6c6c3c _uiapplicationhandleeventqueue + 8496 8   corefoundation                  0x000000018a6bf7f0 __cfrunloop_is_calling_out_to_a_source0_perform_function__ + 20 9   corefoundation                  0x000000018a6beb4c __cfrunloopdosources0 + 252 10  corefoundation                  0x000000018a6bcde4 __cfrunlooprun + 628 11  corefoundation                  0x000000018a5fddcc cfrunlooprunspecific + 448 12  graphicsservices                0x00000001902e5c08 gseventrunmodal + 164 13  uikit                           0x000000018d72efc0 uiapplicationmain + 1152 14  ariablackcar                    0x000000010004baf0 main (main.m:16) 15  libdyld.dylib                   0x00000001971fba9c start + 0 

you can use segue alternative

[self.navigationcontroller pushviewcontroller:pv animated:yes]; 

because time line not work. compiler error. , clean build folder of app. using command+shift+alter+k. , test in device. solve issue.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -