【发布时间】:2014-12-27 11:49:39
【问题描述】:
我正在尝试使用 iOS-GTLYouTube 库来显示视频。到目前为止,这就是我所拥有的:
//Get the youtube video list
GTLServiceYouTube *service = [[GTLServiceYouTube alloc] init];
// Set the APIKey
service.APIKey = @"APIKey";
GTLQueryYouTube *query = [GTLQueryYouTube queryForVideosListWithIdentifier:[vidListIds copy] part:@"id,snippet"];
GTLServiceTicket *ticket = [ service executeQuery:query
completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error)
{
// This callback block is run when the fetch completes
if (error == nil)
{
GTLYouTubeVideoListResponse *products = object;
// iteration of items and subscript access to items.
for (GTLYouTubeVideo *item in products)
{
GTLYouTubeVideoSnippetThumbnails *thumbnails = item.snippet.thumbnails;
[thumbnailMutableList addObject:thumbnails];
NSLog(@"Title: %@", item.snippet.title);
}
}
else
{
NSLog(@"Error: %@", error.description);
}
}];
我不知道为什么,但这段代码似乎没有做任何事情。既没有“标题:”日志也没有“错误”日志。我知道它是在一个单独的线程中完成的,所以它是异步工作的。但我已经等了 1-2 分钟,但仍然没有显示任何内容。有人可以在这里帮助我吗?谢谢。
【问题讨论】:
标签: ios objective-c youtube-api youtube-data-api