Note that there are some explanatory texts on larger screens.

plurals
  1. POThe Google Distance Matrix APi (JSON PARSING)
    text
    copied!<p>i am new programmer. and i am using Google Distance Matrix API. I am first time using JSON . i use the Following but can't get response from server.. please give me few lines code for use JSON and fetch the distance in kilometer between two places.</p> <p><strong>http://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&amp;destinations=San+Francisco|Victoria+BC&amp;mode=bicycling&amp;language=fr-FR&amp;sensor=false</strong></p> <p>Thanks</p> <p>when i use the following API i receive the response</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; NSLog(@"viewdidload"); responseData = [[NSMutableData data] retain]; NSURLRequest *request = [NSURLRequest requestWithURL: [NSURL URLWithString:@"http://api.kivaws.org/v1/loans/search.json?status=fundraising"]]; [[NSURLConnection alloc] initWithRequest:request delegate:self]; } - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { NSLog(@"didReceiveResponse"); [responseData setLength:0]; } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [responseData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { NSLog(@"didFailWithError"); label.text = [NSString stringWithFormat:@"Connection failed: %@", [error description]]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSLog(@"connectionDidFinishLoading"); NSString* newStr = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding]; [self handleResponce:newStr]; // NSLog(@"%@",newStr); } -(void)handleResponce:(NSString *)data { NSLog(@"receive data is ---------&gt;%@",receiveData); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload