3
我以前问过这个问题,但没有答案。所以再问一次。gdata youtube查询问题
我只是不知道要使用哪个gdata框架类,以便我可以搜索youtube视频。我通过调试代码使用了一些类,但是我认为这个框架太深了,需要花费很多时间才能找出这个问题。所以请帮助我。我在我的应用程序中有一个搜索框,我希望在搜索框中输入任何关键字并点击搜索按钮,我应该得到正确的响应。我尝试了一些代码,但总是返回相同的结果。
这里是我的代码...
-(void)searchYoutube
{
NSString *searchString = [NSString stringWithFormat:@"%@", searchField.text];
NSURL *feedURL = [GDataServiceGoogleYouTube youTubeURLForFeedID:nil];
GDataQueryYouTube* query = [GDataQueryYouTube youTubeQueryWithFeedURL:feedURL];
[query setStartIndex:1];
[query setMaxResults:50];
//[query setFullTextQueryString:searchString];
[query setVideoQuery:searchString];
GDataServiceGoogleYouTube *service = [self youTubeService];
GDataServiceTicket *ticket;
ticket = [service fetchFeedWithURL:feedURL delegate:self
didFinishSelector:@selector(ticket:finishedWithFeed:error:)];
}
下面
是的cellForRowAtIndexPath的代码:方法
- (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier = @"Cell";
CustomCellVideoList *cell = (CustomCellVideoList *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[CustomCellVideoList alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
// Configure the cell.
GDataEntryBase *entry = [[feed entries] objectAtIndex:indexPath.row];
//NSString *title = [[entry title] stringValue];
NSArray *thumbnails = [[(GDataEntryYouTubeVideo *)entry mediaGroup] mediaThumbnails];
GDataYouTubeMediaGroup *mediaGroup = [(GDataEntryYouTubeVideo *)entry mediaGroup];
GDataMediaDescription *desc = [mediaGroup mediaDescription];
GDataMediaTitle *mTtile = [mediaGroup mediaTitle];
NSLog(@"media group----- \n\n%@",[(GDataEntryYouTubeVideo *)entry mediaGroup]);
cell.videoTitle.text = [mTtile stringValue ] ;
cell.videoDesc.text = [desc stringValue];
// GDataMediaContent has the urls to play the video....
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:[[thumbnails objectAtIndex:1] URLString]]];
//cell.videoImgView.image = [UIImage imageWithData:data];
cell.data = data;
}
任何帮助是极大的赞赏
感谢
ya谢谢grobbins终于我看到了这个错误,现在它显示正确的结果..非常感谢 – Rakesh 2011-02-14 07:31:45