Skip to content

Instantly share code, notes, and snippets.

@bonkowski
Created March 1, 2012 13:06
Show Gist options
  • Save bonkowski/1949711 to your computer and use it in GitHub Desktop.
Save bonkowski/1949711 to your computer and use it in GitHub Desktop.
Callback handler
- (void)jsonCallback:(int)aCompositeId json:(const char *)json {
NSString *jsonNSString = [NSString stringWithUTF8String:json];
NSDictionary *root = [jsonNSString objectFromJSONString];
if (root) {
NSString *action = [root objectForKey:@"action"];
NSDictionary *options = [root objectForKey:@"options"];
if ([action isEqualToString:POI_CLICKED]) {
[self handlePoiClicked:options];
} else if ([action isEqualToString:CAMERA_POSITION_CHANGE]) {
[self handleCameraPositionChange:options];
} else {
NSLog(@"jsonCallBack not handled: %@", jsonNSString);
}
} else {
NSLog(@"jsonCallBack: Error parsing jsonString '%@'", jsonNSString);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment