Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. -(void) theProblemMethod
  2. {
  3.  
  4. dispatch_async(dispatch_get_main_queue(), ^{
  5. @try {
  6. [[self topViewController] dismissViewControllerAnimated:YES completion: ^{
  7.  
  8. UIViewController * rootViewControler = nil;
  9. if ((rootViewControler = (UIViewController *) [UIApplication sharedApplication].keyWindow.rootViewController))
  10. {
  11. if([self topViewController])
  12. [(UINavigationController *)[self topViewController].navigationController popToViewController:rootViewControler animated:YES];
  13. if ((rootViewControler = (UIViewController *) [[[[UIApplication sharedApplication] delegate] window] rootViewController].presentedViewController)) {
  14. [rootViewControler dismissViewControllerAnimated:YES completion:
  15. ^{
  16. //do something here
  17. }];
  18. }
  19. }
  20. }];
  21.  
  22. } @catch (NSException *exception) {
  23. NSLog(@"There is a problem at [myClass theProblemMethod] Exception: %@, reason: %@", [exception name], [exception reason]);
  24. } @finally {}
  25. });
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement