0

I know this type of question asked previously on SO and I tried all the possible solution but didn't find any suitable solution of it. I am working on a project in which i am using UIWebView inside my UIViewController to open an URL. WebView open successfully and working fine but when i am trying to add image photo library popup open and when i tap on Photo Library button my current view controller dismissed and navigate to previous view and shows the following warning.

> Warning: Attempt to present <UIImagePickerController: 0x7fda28841c00> on <UrlTestViewController: 0x7fda27434860> whose view is not in the window hierarchy!

I am using the following code for webView

- (void)viewDidAppear:(BOOL)animated
{
    NSLog(@"viewDidAppear loaded successfully");
    NSString * addressForUrl = [NSString stringWithFormat:@"%@ %@",RcvdId,RcvdName];
    NSLog(@"Address for url is %@",addressForUrl);

    NSString *trimedString = [addressForUrl stringByReplacingOccurrencesOfString:@"," withString:@""];
    NSLog(@"trimedString for url is %@",trimedString);

    NSString *MaintrimedString = [trimedString stringByReplacingOccurrencesOfString:@" " withString:@"-"];
    NSLog(@"trimedString for url is %@",MaintrimedString);

    NSString * urlStr = [NSString stringWithFormat:@"http://rentingright.com/properties/writereview/%@",MaintrimedString];
    NSLog(@"Complete URL is %@",urlStr);
    //Complete Url http://rentingright.com/properties/writereview/104-21-North-Bruner-Street-Hinsdale-IL-USA
    NSURL *videoUrl = [NSURL URLWithString:urlStr];
    NSURLRequest *request = [NSURLRequest requestWithURL:videoUrl];

    [webVw loadRequest:request];
}

enter image description here

enter image description here

Abhinandan Pratap
  • 2,142
  • 1
  • 18
  • 39
  • read question again it is different from above – Abhinandan Pratap Mar 29 '18 at 08:59
  • You are presenting `UIImagePickerController` on `UrlTestViewController` which is deallocated... – Mahendra Mar 29 '18 at 09:04
  • Show code where you are presenting view controller. – Mahendra Mar 29 '18 at 09:05
  • I am using this code to present ViewController UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; UrlTestViewController *vch = [mainStoryboard instantiateViewControllerWithIdentifier:@"UrlTestViewController"]; [self presentViewController:vch animated:YES completion:Nil]; – Abhinandan Pratap Mar 29 '18 at 09:29

0 Answers0