Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Walking travel mode fixed #9

Open
wants to merge 2 commits into from

1 participant

@sirnicolaz

Setting the travel mode to UICGTravelModeWalking was causing the following error to be thrown

Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Unrecognised leading character (41)\

The bug was caused by a wrong use of GDirections. As stated in the google maps API documentation

The mode of travel, such as driving (default) or walking. Note that if you specify walking directions, you will need to specify a panel to hold a warning notice to users.

then

gdir = new GDirections(null, null);

has been replaced with this

gdir = new GDirections(null, "body");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 26, 2013
  1. @sirnicolaz
Commits on Apr 18, 2013
  1. @sirnicolaz
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 3 deletions.
  1. +8 −2 Classes/UICGRoute.m
  2. +1 −1  api.html
View
10 Classes/UICGRoute.m
@@ -30,8 +30,14 @@ - (id)initWithDictionaryRepresentation:(NSDictionary *)dictionary {
self = [super init];
if (self != nil) {
dictionaryRepresentation = [dictionary retain];
- NSArray *allKeys = [dictionaryRepresentation allKeys];
- NSDictionary *k = [dictionaryRepresentation objectForKey:[allKeys objectAtIndex:[allKeys count] - 1]];
+ NSDictionary *k;
+ for(NSString *key in [dictionaryRepresentation allKeys]){
+ if ([[dictionaryRepresentation objectForKey:key] isKindOfClass:[NSDictionary class]] &&
+ [[dictionaryRepresentation objectForKey:key] objectForKey:@"Steps"]) {
+ k = [dictionaryRepresentation objectForKey:key];
+ }
+ }
+ NSLog(@"K %@", k);
NSArray *stepDics = [k objectForKey:@"Steps"];
numerOfSteps = [stepDics count];
steps = [[NSMutableArray alloc] initWithCapacity:numerOfSteps];
View
2  api.html
@@ -13,7 +13,7 @@
function initialize() {
if (GBrowserIsCompatible()) {
- gdir = new GDirections(null, null);
+ gdir = new GDirections(null, "body");
geocoder = new GClientGeocoder();
GEvent.addListener(gdir, "load", onGDirectionsLoad);
Something went wrong with that request. Please try again.