YouTube UITableView from a search query using GData

妖精的绣舞 提交于 2019-12-24 00:37:45

问题


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.

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];

}

Any help would be appreciated.

--------------------- SOLUTION ----------------------

The problem was in two parts:

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

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

the other selector method wasn't implemented

  • The service should not follow next links coz then all the feed will be fetched

[_service setServiceShouldFollowNextLinks:NO];


回答1:


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.



来源:https://stackoverflow.com/questions/3507967/youtube-uitableview-from-a-search-query-using-gdata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!