Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Places API Not returning a response
    text
    copied!<p>I am following a <a href="http://www.raywenderlich.com/13160/using-the-google-places-api-with-mapkit">Tutorial</a> online and I have 2 methods that submit a query to Google Places API. I am trying to get a response back unfortunately, it is not working. I have a few debug numbers in the code. However, here is the code.</p> <pre><code>-(void) queryGooglePlaces{ NSString *url = @"https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&amp;radius=500&amp;types=food&amp;name=harbour&amp;sensor=false&amp;key=myKey"; //Formulate the string as a URL object. NSURL *googleRequestURL=[NSURL URLWithString:url]; NSLog(@"1.5"); // Retrieve the results of the URL. dispatch_async(kBgQueue, ^{ NSData* data = [NSData dataWithContentsOfURL: googleRequestURL]; [self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES]; }); NSLog(@"2"); } -(void)fetchedData:(NSData *)responseData { //parse out the json data NSError* error; NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&amp;error]; //The results from Google will be an array obtained from the NSDictionary object with the key "results". NSArray* places = [json objectForKey:@"results"]; //Write out the data to the console. NSLog(@"Google Data: %@", places); NSLog(@"3"); } </code></pre> <p>On the log the output goes as such: </p> <pre><code>2012-08-03 16:40:12.411 sCode[25090:1a303] 1.5 2012-08-03 16:40:12.411 sCode[25090:1a303] 2 2012-08-03 16:40:12.512 sCode[25090:1a303] 4 2012-08-03 16:40:12.751 sCode[25090:1a303] Google Data: ( ) 2012-08-03 16:40:12.751 sCode[25090:1a303] 3 2012-08-03 16:40:13.628 sCode[25090:1a303] 1 2012-08-03 16:40:14.129 sCode[25090:1a303] 4 </code></pre> <p>Can anybody tell me whats going wrong so I didn not get a response.? yes I did call <code>[self queryGooglePlaces];</code> in my <code>ViewDidLoad</code> method Appreciate the help guys! Sorry if im too verbose..just a starter trying to learn!</p>
 

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