Skip to content

Instantly share code, notes, and snippets.

@fisherds
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save fisherds/f78046a14b904870e3c8 to your computer and use it in GitHub Desktop.

Select an option

Save fisherds/f78046a14b904870e3c8 to your computer and use it in GitHub Desktop.
Perform a query for Moviequotes
- (void) _queryForQuotes {
// #1. Make a query object
// #2. Use the service to execute the query
// #3. Use a callback block to handle the response
GTLQueryMoviequotes* query = [GTLQueryMoviequotes queryForMoviequoteList];
query.order = @"-last_touch_date_time";
query.limit = 30;
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
[self.service executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
GTLMoviequotesMovieQuoteCollection* response,
NSError *error) {
self.initialQueryComplete = YES;
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
if (error != nil) {
[self _showErrorDialog:error];
} else {
self.quotes = [response.items mutableCopy];
if (response.nextPageToken != nil) {
NSLog(@"There is more data available! Use %@ to get it!",
response.nextPageToken);
}
}
[self.tableView reloadData];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment