How to use Youtube API (GTLYoutube) to search for videos on iPhone sdk?

I work about 10 hours and I completely lost 100%. I'm trying to just request youtube, say, for "iPad". Then youtube should return a list of search results ... But I'm having all kinds of problems. Here is my code:

// Create a service object for executing queries GTLServiceYouTube *service = [[GTLServiceYouTube alloc] init]; // Services which do not require sign-in may need an API key from the // API Console service.APIKey = @"AIzaSyD9pvsUtnegJvwv5z5XrBO5vFTBVpErYN8"; // Create a query GTLQueryYouTube *query = [GTLQueryYouTube queryForSearchListWithPart:@"video"]; query.q = @"hiking boots"; //query.country = @"US"; // Execute the query GTLServiceTicket *ticket = [service executeQuery:query completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) { // This callback block is run when the fetch completes if (error == nil) { //I'VE NEVER GOTTEN TO HERE, I ALWAYS GET AN ERROR } }else{ NSLog(@"Error: %@", error.description); } }]; 

If I do this, I get the following error:

  Error Domain=com.google.GTLJSONRPCErrorDomain Code=403 "The operation couldn't be completed. (Access Not Configured)" UserInfo=0x1edab4c0 {error=Access Not Configured, GTLStructuredError=GTLErrorObject 0x1eda3f80: {message:"Access Not Configured" code:403 data:[1]}, NSLocalizedFailureReason=(Access Not Configured)} 

What should I do?

+4
source share
2 answers

The "Access Not Configured" error is likely because you did not enable the Youtube data API in the Google API console.

You can access this here: https://code.google.com/apis/console

Click Services and verify that the Youtube Data API is enabled.

+2
source

There is a known google problem ( https://code.google.com/p/gdata-issues/issues/detail?id=5770 ), which makes it so that even if you have the correct API, it will still be a workaround remove the bundleID from the Google console for the project.

+2
source

All Articles