i need to open a link in safari browser but i have doubt, which method should i use ? openURL/open
or canOpenURL
.
Can anyone please help me to explain what actual difference between both function?
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL(string: urlStr)!, options: [:], completionHandler: nil)
UIApplication.shared.canOpenURL(URL(string: urlStr)!)
} else {
UIApplication.shared.openURL(URL(string: urlStr)!) //introduced: 2.0, deprecated: 10.0,
UIApplication.shared.canOpenURL(URL(string: urlStr)!) // available(iOS 3.0, *)
}