晚安
如何打开Waze应用程序并设置地址而不是使用坐标?此刻我正在那样做:
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)
}
}
在上面触发此方法的另一个类中:
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)
}
此后,Waze应用程序自行打开,但是它在地图屏幕上变为静态,而不是启动导航。我在做什么错了?
这是我的字符串地址:
"https://waze.com/ul?ll=R%20VISCONDE%20DE%20URUGUAI%20%2C%20311%20%20-%20CENTRONiter%C3%B3i%20-%20RJ&navigate=yes"