使用GData从搜索查询中获取YouTube UITableView [英] YouTube UITableView from a search query using GData

查看:38
本文介绍了使用GData从搜索查询中获取YouTube UITableView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自定义表格视图,以根据搜索查询显示YouTube视频的供稿.我发现此代码 http://pastebin.com/vmV2c0HT 可以在表格视图中显示YouTube频道的供稿,效果很好.但是,在修改viewDidLoad函数以搜索查询而不是用户供稿时,我总是以空白表视图结束.

I'm trying to customize a table view to display a feed of youtube videos based on a search query. I found this code http://pastebin.com/vmV2c0HT which displays a feed of a YouTube channel in a tableview, it works fine. However, when modifying the viewDidLoad function to search for a query instead of a user feed, I always end up with a blank table view.

这是我的viewDidLoad函数:

Here is my viewDidLoad function:

- (void)viewDidLoad {

GDataServiceGoogleYouTube *service = [self youTubeService];

NSString *searchString = @"football";

NSString *uploadsID = kGDataYouTubeUserFeedIDUploads;

NSURL *feedURL = [GDataServiceGoogleYouTube youTubeURLForFeedID:nil];

GDataQueryYouTube* query = [GDataQueryYouTube  youTubeQueryWithFeedURL:feedURL];

[query setVideoQuery:searchString];

[query setMaxResults:5];

[service fetchFeedWithQuery:query delegate:self didFinishSelector:@selector(entryListFetchTicket:finishedWithFeed:)];

[super viewDidLoad];

}

任何帮助将不胜感激.

---------------------解决方案----------------------

问题分为两部分:

-查询获取调用中有一个错误,将其更改为:

-There was a mistake in the query fetch call, change it to:

[服务fetchFeedWithQuery:query委托:self didFinishSelector:@selector(request:finishedWithFeed:error:)];

[service fetchFeedWithQuery:query delegate:self didFinishSelector:@selector(request:finishedWithFeed:error:)];

其他选择器方法未实现

  • 该服务不应跟随下一个链接,因为所有提要都将被获取

[_ service setServiceShouldFollowNextLinks:NO];

[_service setServiceShouldFollowNextLinks:NO];

推荐答案

您的cellForRowAtIndexPath方法是什么样的?也许您为搜索查询获得的响应采用不同的格式,因此您先前为cellForRowAtIndexPath编写的代码不再适用.您可以尝试进行一些NSLog调用,以查看所需信息.

What does your cellForRowAtIndexPath method look like? Maybe the response you get for a search query is in a different format, and so the previous code you had for cellForRowAtIndexPath no longer applies. You can try doing some NSLog calls to see what the information looks like if you want.

这篇关于使用GData从搜索查询中获取YouTube UITableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆