我已经工作了大约 10 个小时,我完全 100% 迷失了方向。我试图简单地查询 youtube,比如“iPad”。然后 youtube 应该返回一个搜索结果列表......但我遇到了各种各样的问题。这是我的代码:
// 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);
}
}];
如果我这样做,我会收到以下错误:
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)}
我该怎么办??