Last active
August 29, 2015 14:04
-
-
Save fisherds/f78046a14b904870e3c8 to your computer and use it in GitHub Desktop.
Perform a query for Moviequotes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (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