While i am Moving From PassCode Controller to OTP ViewController, iam getting the following error in console:
Warning: Attempt to present < OTPController: 0x1e56e0a0 > on < PassCodeController: 0x1ec3e000> whose view is not in the window hierarchy!
This is the code I'm using to 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 am presenting PassCode Controller From RegistrationViewController:
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PassCodeViewController *passVC = [storyboard instantiateViewControllerWithIdentifier:@"PassCodeViewController"];
[self presentViewController:passVC animated:YES completion:nil];
Use below line of code ..
That happen because of two viewcontroller present and dismiss at a same time or you are trying to present ViewController immediately at the viewcontroller open
ViewDidload
method soFirst:
viewDidAppear
Method or instead ofViewDidload
.Second:
I suggest to make use of completion method for present and dismiss viewcontrolelr like following example:
UPDATE:
Create a separate method of presenting a OTPViewController like following:
Now call this method with 1 second Delaya using
performSelector
You need to put above performselect code in
t
Try to present it from rootViewController,
[self.view.window.rootViewController presentViewController:lOTPViewController animated:YES completion:nil];