开发者

YouTube UITableView from a search query using GData

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜