0

我想为 iphone 使用 youtube v3 api,我有这个错误“Error Domain=com.google.GTMOAuth2 Code=-1001”我的代码:

-(void)load{
NSString *clientID = kClientIDKey;
NSString *clientSecret = kClientSecretKey;

  GTMOAuth2Authentication *auth = nil;

if (clientID && clientSecret) {
   auth = [GTMOAuth2ViewControllerTouch  authForGoogleFromKeychainForName:kKeychainItemName
                                                             clientID:clientID
                                                            clientSecret:clientSecret];

}
if (auth.canAuthorize) {
    // Select the Google service segment
   // self.serviceSegments.selectedSegmentIndex = 0;

}
mAuth = auth;

GTLServiceYouTube* youtubeService = nil;
GTLQueryYouTube* videoQuery =nil;
//youtubeService type is GTLServiceYouTube
youtubeService = [[GTLServiceYouTube alloc] init];
youtubeService.shouldFetchNextPages = YES;

//auth is the object from the authentication callback

youtubeService.authorizer = mAuth;
videoQuery = [GTLQueryYouTube queryForSearchListWithPart:@"id"];
videoQuery.maxResults = 1;
videoQuery.q = @"Ndhblue8x";
GTLServiceTicket* youtubeTicket = [youtubeService executeQuery:videoQuery
                                             completionHandler:^(GTLServiceTicket *ticket, GTLYouTubeChannel *channel,
                                                                 NSError *error) {
                                                 NSLog(@" %@ ", error.description);
                                                 NSLog(@"WIN! : %@ ", channel.description);
                                             }];

}

我不懂为什么。请帮我确定它是假的!

4

0 回答 0