Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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
Swift UIC应用程序未打开url_Swift_Url_Uigesturerecognizer_Uiapplication - Fatal编程技术网

Swift UIC应用程序未打开url

Swift UIC应用程序未打开url,swift,url,uigesturerecognizer,uiapplication,Swift,Url,Uigesturerecognizer,Uiapplication,我从一个结构中获取URL并将其发送到一个uitappostation,我尝试打印它(它打印URL),但它不想实际打开URL @objc func getUrl(sender: UITapGestureRecognizer){ guard let url = self.rssUrl else { return } print(url) UIApplication.shared.open(url, options: [:], completionHandler: nil)

我从一个结构中获取URL并将其发送到一个
uitappostation
,我尝试打印它(它打印URL),但它不想实际打开URL

@objc func getUrl(sender: UITapGestureRecognizer){
    guard  let url = self.rssUrl else { return }
    print(url)
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
在这里抓取URL

var rssUrl: URL?

var item: RSSItem! {
    DispatchQueue.global(qos: .userInteractive).async {
        //other code

        let store_Article = Article(dict: ["text": sum, "rssUrl": rssLink])
        storedArticle.append(store_Article)

        let data = dataUrl.init(articleUrl: store_Article).someUrl

        DispatchQueue.main.sync {
            //other code
        }
    }
}
编辑

它打印:http://www.instyle.com/news/rihanna-30th-birth-party——文件:///

举个例子

试试这个 编辑

@objc func getUrl(sender: UITapGestureRecognizer)
{
    guard let url = URL(string: YOUR_URL_STRING) else {
        return //be safe
    }

    if #available(iOS 10.0, *) {
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    } else {
        UIApplication.shared.openURL(url)
    }
}

你得到了什么(url)?@KamleshShingarakhiya查看编辑最近几天你有多少帐户?这至少是三个。为什么?@rmaddy just 3它一直禁止我问问题,即使在一个小时之后week@rmaddy我有一个帐户,做得很好,然后突然堆栈禁止我问这不工作,它给出了一个错误类型,URL是类型URL我检查了它的工作良好。请检查编辑应答!快乐编码!!