我的 .txt 文件中有一个 URL 链接UITextView。在我的 iPhone 中,同时有 Safari 和 Chrome 应用程序。每当我单击 URL 链接时,我想在弹出视图中列出 safari 和 Chrome(以及手机中的所有其他浏览器),以便用户可以选择他们想要打开该 URL 的浏览器。现在它总是打开 safari,因为它是我手机中的默认浏览器。有什么办法可以选择浏览器打开网址吗?我知道有这个代表
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool {
// Got the url here. how can i force this url to open in chrome
return true
}
Run Code Online (Sandbox Code Playgroud)
但我怎样才能强制这个网址在 Chrome 或任何其他浏览器中打开?如何在视图中列出所有可用的浏览器?