I'm trying to open Yelp from within my App that has a deployment target of 8.1
The problem I'm facing is my code is not properly evaluating on the simulator. My device is iOS 10.3, and it works fine on there (Yelp opens), but I need to be able to check to see if this works on the simulator for older versions of iOS!
let urlStr: String = "yelp://"
let url = URL(string: urlStr)
if UIApplication.shared.canOpenURL(url!) {
print("can open")
if #available(iOS 10.0, *) {
print("10")
UIApplication.shared.open(url!, options: [:], completionHandler: nil)
} else {
print("NOT 10")
UIApplication.shared.openURL(url!)
}
}
else {
// Can not open URL
print("can not open url")
}
While in the simulator (iOS 8.1), the following prints to the console:
can open
NOT 10
However, this is wrong! Yelp is not installed on the simulator - but if that's the case, wouldn't print("can not open url")
evaluate??
Here's my URLTypes / LSApplicationQueriesSchemes in the info.plist.
Is there anything wrong with my code above? How can I properly test the opening of Yelp on the simulator, where I'm able to QA on various builds of iOS (starting at 8.1)? Thanks friends.