Set Custom Coordinates to a function, Waze Integration

Viewed 4848

I'm trying to implement navigation using Waze in my App, using their own API: here.

I want to set in custom coordinates that are set in an array and then fit them in this code:

func navigate(toLatitude latitude: Double , longitude: Double) {
                if UIApplication.shared.canOpenURL(URL(string: "waze://")!) {
                    // Waze is installed. Launch Waze and start navigation
                    let urlStr: String = "waze://?ll=\(latitude),\(longitude)&navigate=yes"
                    UIApplication.shared.openURL(URL(string: urlStr)!)
                }
                else {
                    // Waze is not installed. Launch AppStore to install Waze app
                    UIApplication.shared.openURL(URL(string: "http://itunes.apple.com/us/app/id323229106")!)
                }
            }

i have tried settings up different type of arrays but didn't succeed to make it work . So if you could help me out set custom array holding latitude and longitude that would work properly with the code, that would be awesome

your help will be very much helpful,

Thank you in advance.

3 Answers

When compiling with iOS SDK 9.0 and later, you must update your application's property list file with the following to include Waze:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>waze</string>
</array>

Related