如何在webview中打开safari中的特定链接?

时间:2017-10-20 01:42:20

标签: ios objective-c xcode ionic3

我正在使用inappbrowser插件进行Ionic 3项目

我想在我的应用程序ios中打开safari中的特定链接

这是我使用的代码

- (BOOL) isSystemUrl:(NSURL*)url
{
    if ([[url host] isEqualToString:@"itunes.apple.com"]) {
        return YES;
    }
    else if ([[url host] containsString:@"aff"]) {
        [[UIApplication sharedApplication] openURL:url];
    }

    return NO;
}

在webview中打开的链接显示可点击的项目

这是其中之一

<a onclick="gotoOffer(&quot;Install, Open, and Complete Character Level 5 to unlock this content.&quot;, &quot;https:\/\/jump.ogtrk.net\/aff_c?offer_id=10312&amp;aff_id=39763&amp;aff_sub=f7b876a48d743dedc6bc548908a5cec1&amp;aff_sub2=0vhEVTB6vnEGatmzW%2Fui5r3fJaltF7VRoCNZ%2B1LSy72LdSlDMAG16sCfJIUTWgVmH7nr4mi%2FLg9RQyQmlgpwTY7JBDUtVPgbCCun%2FFqOFeube0vb85CKpcpfX5aqrWb%2FlKYBa7O%2F63dheSeOFBQA%2BA%3D%3D&amp;aff_sub3=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1MDg0NjIyNDEsImp0aSI6Imc5TGVVdWE4MU5MM1hWT1pWTThpekFCODFRRWIrU2FsOXZXbEk2QmxCTEk9IiwiaXNzIjoib2dhZHMiLCJuYmYiOjE1MDg0NjIyNDEsImV4cCI6MTUxMTA1NDI0MSwiZGF0YSI6eyJpcCI6IjEwNS4xNTUuMjI0LjI0NyIsInJlZiI6ImFIUjBjSE02THk5M2QzY3ViVzlpYVd4bGIyRnphWE11Ym1WMEwyTnNMbkJvY0Q5cFpEMW1OMkk0TnpaaE5EaGtOelF6WkdWa1l6WmlZelUwT0Rrd09HRTFZMlZqTVE9PSIsInVhIjoiTW96aWxsYVwvNS4wIChMaW51eDsgQW5kcm9pZCA2LjA7IE5leHVzIDUgQnVpbGRcL01SQTU4TikgQXBwbGVXZWJLaXRcLzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIENocm9tZVwvNjEuMC4zMTYzLjEwMCBNb2JpbGUgU2FmYXJpXC81MzcuMzYifX0.w4baABUDoC31IbsyIcYFdYYH3rWhPSiIdbMMC21RZKeF3C47bQmTAUecD6ckjEZHSRaSTFb86ippA8EdHr19rQ&amp;aff_sub4=&amp;aff_sub5=&quot;);">
                    <div class="offerimg"><img src="https://media.go2speed.org/brand/files/ogmobi/10312/thumbnails_100/thumbnail-90417287459948b60896fe9.08798511.png"></div>
                </a>

根据我在我的代码中的内容,它必须在safari中打开,因为链接有一个字符串aff word

但它在xcode控制台中显示此错误

Failed to load webpage with error: The URL can’t be shown

但如果链接就像这样,那就完美了

<a href="http://www.example.com/aff?id=876">

0 个答案:

没有答案