尝试在视图不在窗口层次结构中的<uiimagepickercontroller on =“”uiviewcontroller =“”>上

时间:2018-03-29 08:55:10

标签: ios objective-c webview uiimagepickercontroller

我知道之前在SO上提出的这类问题,我尝试了所有可能的解决方案,但没有找到任何合适的解决方案。 我正在开展一个项目,我在UIWebView内使用UIViewController打开URLWebView成功打开并且工作正常,但是当我尝试添加图片照片库弹出窗口时,当我点击照片库按钮时,我当前的视图控制器被解除并导航到上一个视图并显示以下警告。

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

我正在使用以下代码进行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

0 个答案:

没有答案