I am trying to add multiple waypoints to my google directions request.
When I add a single waypoint like
https://maps.googleapis.com/maps/api/directions/json?&origin=51.507679,-0.125004&waypoints=51.524151,-0.123174&destination=51.495777,-0.108642&mode=walking
it works fine but when I try to add multiple waypoints like
https://maps.googleapis.com/maps/api/directions/json?&origin=51.606502,0.527309&waypoints=51.507679,-0.125004|51.524151,-0.123174&destination=51.495777,-0.108642&mode=walking
i receive a 'unsupported URL' error. What is the correct way to add multiple waypoints? Thanks
Its very simple, Just replace '|' with '%%7C'
Your updated url will be :
https://maps.googleapis.com/maps/api/directions/json?&origin=51.606502,0.527309&waypoints=51.507679,-0.125004%%7C51.524151,-0.123174&destination=51.495777,-0.108642&mode=walking
Happy Coding
I give you the solution step by step
First we should get the Google Map SDK
Drag the following bundles into your project (when prompted, select Copy items if needed):
Right-click GoogleMaps.framework in your project, and select Show In Finder.
Drag the GoogleMaps.bundle from the Resources folder into your project. When prompted, ensure Copy items into destination group's folder is not selected.
Select your project from the Project Navigator, and choose your application's target.
Open the Build Phases tab, and within Link Binary with Libraries, add the following frameworks:
Now Get the API key
Now you need to add following things in Plist
AppDelegate.m
ViewController.h
ViewController.m
pragma mark - Drawing Lines