1

Getting this kind of errors while moving the controller from one screen to other.

Presenting view controllers on detached view controllers is discouraged.

Bhavin Bhadani
  • 22,224
  • 10
  • 78
  • 108
Lotus Shah
  • 493
  • 4
  • 13

2 Answers2

1
  [self.view.window.rootViewController presentViewController:viewController animated:YES completion:nil];

when everything is finished, you can just call :

 [self dismissViewControllerAnimated:YES completion:nil];

you can also refer this link : Warning :-Presenting view controllers on detached view controllers is discouraged

Community
  • 1
  • 1
Chetan Hedamba
  • 229
  • 2
  • 7
0

Following code worked for me

Display your viewController on its parent as given below:

[self.YourParentViewController presentViewController:yourPresentingViewController animated:YES completion:nil];

And dismiss like this:

[self dismissViewControllerAnimated:YES completion:nil];
Pranav
  • 701
  • 4
  • 18