Reputation: 825
Why UIApplication.shared.canOpenURL(:)
method not working on iOS 11.4 - iPad Devices? although it's working fine on iOS 11 & 12.0 [iPhone devices]!
Note:
https
Upvotes: 0
Views: 585
Reputation: 1046
Ok, Bro, I had the same problem with facebook open share link and I solve the problem when I change the shareDialog.mode to .automatic
So you can try this way and tell me if it works?
let url = URL(string: "www.google.com")
let content = LinkShareContent(url: url, quote: "Google")
let shareDialog = ShareDialog(content: content)
shareDialog.mode = .automatic
shareDialog.presentingViewController = self
shareDialog.failsOnInvalidData = true
shareDialog.completion = { result in
}
do {
try shareDialog.show()
} catch {
print("Error")
}
as our discussion, you need to open a web view in your app
so you can add this
import UIKit
class WebVC: UIViewController {
@IBOutlet weak var webView: UIWebView!
var url = ""
var firstLoad = true
override func viewDidLoad() {
super.viewDidLoad()
self.setup()
}
func setup() {
self.webView.backgroundColor = Color.white.value
self.webView.delegate = self
var urlRequest = URLRequest(url: URL(string: url)!)
urlRequest.cachePolicy = .reloadIgnoringCacheData
self.webView.loadRequest(urlRequest)
}
}
and in your controller, you can use
func openWebView() {
let webVC = WebVC()
webVC.url = "www.google.com"
webVC.title = "Google"
self.navigationController?.pushViewController(webVC, animated: true)
}
Upvotes: 1