Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c UIWebView阻止弹出窗口也会阻止原始站点_Objective C - Fatal编程技术网

Objective c UIWebView阻止弹出窗口也会阻止原始站点

Objective c UIWebView阻止弹出窗口也会阻止原始站点,objective-c,Objective C,我试图阻止弹出窗口,但我发现委托方法读取的url与原始url不同:original:http://ti.me/1ifSRHg我看到的地方:ti.me //块弹出窗口 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSString *host = [

我试图阻止弹出窗口,但我发现委托方法读取的url与原始url不同:original:
http://ti.me/1ifSRHg
我看到的地方:
ti.me

//块弹出窗口

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSString *host = [request.URL host];
    NSLog(@"host:%@",host); // host:ti.me
    if ( [host isEqualToString:[Globals sharedGlobals].currentLink] )
    {
        NSLog(@"yes");

        return YES;
    }
    NSLog(@"no");
    return NO;
}

哦,好的,我在找主持人

应该是

NSURL *host = request.URL;