为什么我的 webPageProxy 加载失败

时间:2021-01-26 16:58:46

标签: ios objective-c uiwebview

我有一个应用程序,它加载一个 webView,显示来自我家中的摄像头的视频流。我打开了端口转发,一切正常。但是,在查看我的日志时,我得到以下信息:

2021-01-25 13:41:08.712156-0700 iphoneMQTT[45891:2000494] [Loading] 0x14281ce18 - [pageProxyID=6, webPageID=7, PID=45892] WebPageProxy::didFailLoadForFrame: frameID = 3, domain = NSURLErrorDomain, code = -1005

这是我的代码:

-(void)viewDidLoad {
    if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
       self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(self.view.center.x-(self.view.frame.size.width/2),self.view.center.y-((self.view.frame.size.width*.5)/2), self.view.frame.size.width, self.view.frame.size.width*.7) configuration:theConfiguration];
    }
    else if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad){
        self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(self.view.center.x-(600/2),self.view.center.y-(420/2), 600, 420) configuration:theConfiguration];
    }
            
        
    _webView.contentMode = UIViewContentModeScaleToFill;
    _webView.backgroundColor = [UIColor blackColor];
      
    
       
     nsurl=[NSURL URLWithString:http];//@"http://70.176.81.136:81/CFC878/1"];
     nsrequest=[NSURLRequest requestWithURL:nsurl];
     [_webView loadRequest:nsrequest];
}

然后我显示流并将其删除。

-(IBAction)showVideo:(id)sender;{
    [self.view insertSubview:self.webView atIndex:12];
    self.novideo.hidden = NO;
    self.novideo.enabled = YES;
}
    
-(IBAction)stopVideo:(id)sender;{
        
   [self.webView removeFromSuperview];
   self.novideo.hidden = YES;
   self.novideo.enabled = NO;
}

这是个问题吗?

0 个答案:

没有答案
相关问题