关于在iPhone上使用Google GData API - Youtube的任何示例/教程? [英] Any examples/tutorials on using Google GData API - Youtube on iphone?

查看:167
本文介绍了关于在iPhone上使用Google GData API - Youtube的任何示例/教程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在UITableView中列出特定用户上传的视频(YouTube)。我已经下载了GData源代码和示例项目(不是特定于iphone的),但我似乎无法让它工作。有没有人知道有什么好的(或者说根本没有))教程?

I need to list a specific users uploaded videos (YouTube) in a UITableView. I've downloaded the GData source and example projects (not iphone specific) but I can't seem to get it to work. Does anybody know of any good (or any at all ;)) tutorials out there?

祝你好运,
Magnus

Best regards, Magnus

推荐答案

假设您已将GData客户端库包含到项目中,则需要调用以获取用户的上载,然后显示它们。这是我能想到的最简单的方法:

Assuming you have included the GData client libraries to your project, you need to make a call to fetch the user's uploads, and then display them. Here's the simplest way I can think of:

在表视图控制器类中创建一个实例变量,该变量将保存从YouTube API返回的Feed数据。

Create an instance variable in your table view controller class that will hold the feed data returned from the YouTube API.

#import "GDataYouTube.h"
#import "GDataServiceGoogleYouTube.h"

@interface RootViewController : UITableViewController {
    GDataFeedYouTubeVideo *feed;
}

@property (nonatomic, retain) GDataFeedYouTubeVideo *feed;

在实施文件中,拨打API以获取所有上传的视频。在回调选择器 request:finishedWithFeed:error 中,以任何适合的格式存储结果,并重新加载表视图。在表视图 cellForRowAtIndexPath 方法中,根据需要格式化单元格:

Inside the implementation file, make a call to the API to fetch all uploaded videos. Inside the callback selector request:finishedWithFeed:error, store the results in whatever format suits, and reload the table view. In the table views cellForRowAtIndexPath method, format the cell as desired:

// get the youtube service
GDataServiceGoogleYouTube *service = [self youTubeService];

// feed id for user uploads
NSString *uploadsID = kGDataYouTubeUserFeedIDUploads;
// construct the feed url
NSURL *feedURL = [GDataServiceGoogleYouTube youTubeURLForUserID:@"annoyingorange"
                                            userFeedID:uploadsID];

// make API call
[service fetchFeedWithURL:feedURL
         delegate:self
         didFinishSelector:@selector(request:finishedWithFeed:error:)];

查看

Checkout the full source code for RootViewController.

这篇关于关于在iPhone上使用Google GData API - Youtube的任何示例/教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆