Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone gdatayoutube查询问题_Iphone_Youtube Api_Gdata Api - Fatal编程技术网

Iphone gdatayoutube查询问题

Iphone gdatayoutube查询问题,iphone,youtube-api,gdata-api,Iphone,Youtube Api,Gdata Api,我以前问过这个问题,但没有答案。再问一次 我只是不知道该使用哪个gdata框架类,这样我就可以搜索youtube视频了。我通过调试代码使用了一些类,但我认为框架太深了,需要花很多时间才能解决这个问题。所以请帮帮我。我的应用程序中有一个搜索框,我希望在该搜索框中输入任何关键字并点击搜索按钮后,我会得到正确的响应。我尝试了一些代码,但总是返回相同的结果 这是我的密码 -(void)searchYoutube { NSString *searchString = [NSString stringWi

我以前问过这个问题,但没有答案。再问一次

我只是不知道该使用哪个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;

}
非常感谢您的帮助


谢谢

查询对象将查询参数添加到提要URL中

您可以使用NSLog(@“%@,[query URL]”查看完整的查询字符串

使用[service fetchFeedWithQuery:query…]执行提取
或者等效的[service fetchFeedWithURL:[查询URL]…]

ya谢谢grobbins最后我看到了这个错误,现在它显示了正确的结果。。非常感谢