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