Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSString *baseUrl=[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/directions/json? origin=indore&destination=bhopal&key=%@&alternatives=true”,APIKey];
- NSURL *url = [NSURL URLWithString:[baseUrl
- stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
- NSURLRequest *request = [NSURLRequest requestWithURL:url];
- [NSURLConnection sendAsynchronousRequest:request queue:
- [NSOperationQueue mainQueue] completionHandler:^(NSURLResponse
- *response, NSData *data, NSError *connectionError) {
- if(!connectionError){
- NSDictionary *result= [NSJSONSerialization JSONObjectWithData:data
- options:0 error:nil];
- // this will return all possible roots
- NSArray *routes = [result objectForKey:@"routes"];
- //add The polyline between locations.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement