objective c - iOS whose view is not in the window hierarchy -


while moving passcode controller otp viewcontroller, iam getting following error in console:

warning: attempt present < otpcontroller: 0x1e56e0a0 > on < passcodecontroller: 0x1ec3e000> view not in window hierarchy!

this code i'm using change between views:

uistoryboard  *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil];     otpviewcontroller *lotpviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"otpviewcontroller"];     lotpviewcontroller.comingfromreg = true;      [self presentviewcontroller:lotpviewcontroller animated:yes                      completion:nil]; 

i presenting passcode controller registrationviewcontroller:

uistoryboard* storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil];         passcodeviewcontroller *passvc =  [storyboard instantiateviewcontrollerwithidentifier:@"passcodeviewcontroller"];         [self presentviewcontroller:passvc animated:yes completion:nil]; 

that happen because of 2 viewcontroller present , dismiss @ same time or trying present viewcontroller @ viewcontroller open viewdidload method

first:

  • present viewcontroller viewdidappear method or instead of viewdidload.

second:

i suggest make use of completion method present , dismiss viewcontrolelr following example:

[self presentviewcontroller:lotpviewcontroller animated:yes                              completion:^{          }]; 

update:

create separate method of presenting otpviewcontroller following:

-(void)presentotpviewcontroller {      uistoryboard  *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil];     otpviewcontroller *lotpviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"otpviewcontroller"];     lotpviewcontroller.comingfromreg = true;      [self presentviewcontroller:lotpviewcontroller animated:yes                      completion:^{}];  } 

now call method 1 second delaya using performselector

[self performselector:@selector(presentotpviewcontroller) withobject:self afterdelay:1.0 ]; 

you need put above performselect code in

[self dismissviewcontrolleranimated:yes completion:^{  [self performselector:@selector(presentotpviewcontroller) withobject:self afterdelay:1.0 ]; }]; // dismiss method of passcodeviewcontroller 

t


Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -