I integrated Waze into my Swift app, but when I click on the button, Waze opens but nothing happens with the navigation. I juste see the app and that's all, instead of launching the navigation.
Here is the code:
@IBAction func openWazeAction(_ sender: Any) {
// open waze
if UIApplication.shared.canOpenURL(URL(string: "waze://")!) {
let urlStr = String(format: "waze://ul?ll=%f,%f&navigate=yes", (selectedBorne?.location?.x)!, (selectedBorne?.location?.y)!)
print(urlStr)
UIApplication.shared.open(URL(string: urlStr)!)
} else {
UIApplication.shared.open(URL(string: "http://itunes.apple.com/us/app/id323229106")!)
}
}
The print(urlStr)
returns the right URL: waze://ul?ll=48.792914,2.366290&navigate=yes
, but nothing happens in the Waze app.
(I put the LSApplicationQueriesSchemes in the Info.plist file.)
What is wrong here?