1
Good night, you guys
How do I open Waze in the app and set the address via string (I want to navigate directly by address, not by coordinates) Right now, I’m doing it this way:
func showWazeNaviationWithUrl(_ strURL: String) {
if let url = URL(string: "waze://") {
if UIApplication.shared.canOpenURL(url) {
if let url = URL(string: strURL) {
UIApplication.shared.openURL(url)
}
} else {
//Waze is not installed. Launch AppStore to install Waze app
if let url = URL.init(string: "https://itunes.apple.com/app/id323229106") {
UIApplication.shared.openURL(url)
}
}
in another class that fires this method, I have the following:
func startNavigation(address: String) {
var allowedQueryParamAndKey = NSCharacterSet.urlQueryAllowed
allowedQueryParamAndKey.remove(charactersIn: ";/?:@&=+$, ")
let _address = address.addingPercentEncoding(withAllowedCharacters: allowedQueryParamAndKey)
let strURL = String(format: "https://waze.com/ul?ll=%@&navigate=yes", _address!)
self.delegate?.showWazeNaviationWithUrl(strURL)
}
After all this is executed, the app opens however, it doesn’t open the navigation window... It just sits on the map.
My String with the address is as follows:
"https://waze.com/ul?ll=R%20VISCONDE%20DE%20URUGUAI%20%2C%20311%20%20-%20CENTRONiter%C3%B3i%20-%20RJ&navigate=yes"