Tag: 谷歌API objc客户端

在应用程序中设置YouTube访问,坚持检索URL响应

我无法find任何答案或类似的问题,我的YouTube API难题,希望有人可以帮助。 我的iOS应用程序需要连接到用户的YouTube帐户,以便他们可以上传video给其他人看。 我遵循API文档,并设法连接到用户login到其帐户的validation部分(我使用的代码如下)。 它的工作原理是,它将用户带到Google的login页面,当login页面询问用户是否想授权应用程序访问帐户等。当用户接受,但我知道应该有数据返回给出应用程序authentication,令牌代码,所以它可以用来稍后在应用程序内上传video。 我的问题是….我如何检索这些数据? 当我点击接受它只是带我到另一个网页,但我不知道在哪里检索信息。 预先感谢任何能指引我正确方向的人。 #define kAuthUrl @"https://accounts.google.com/o/oauth2/auth?" #define kClientID @"client_id=xxxxxxxxxxxMyUniqueIDDetailsxxxxxxxxxx&" #define kRediretUri @"redirect_uri=urn:ietf:wg:oauth:2.0:oob&" #define kScopeUL @"scope=https://www.googleapis.com/auth/youtube.upload&" #define kResponse @"response_type=code" 上面的代码放在头文件中。 – (void)viewDidLoad { NSString *loginURL = [NSString stringWithFormat:@"%@%@%@%@%@", kAuthUrl, kClientID, kRediretUri, kScopeUL, kResponse]; NSURLRequest * urlReq = [NSURLRequest requestWithURL: [NSURL URLWithString:loginURL]]; [_webView loadRequest:urlReq]; [super viewDidLoad]; // Do any additional setup after […]

通过IOS Google Drive SDK在Google云端硬盘中列出指定文件夹中的所有文件

其实我整合了谷歌驱动器SDK与我的iOS应用程序。 我可以通过谷歌驱动器ios sdk检索/上传文件在谷歌驱动器。 但是从指定的父文件夹中检索文件列表需要很多时间。 这里的步骤和我正在使用的代码。 首先获取指定父文件夹的子项,然后获取每个子项的GTLDriveChildReference ,然后使用子项引用标识符查询。 对我来说这是一个巨大的过程。 也是每次都要求google服务器。 任何更好的方法只是在查询中传递父文件夹标识并从该父文件夹中提取文件。 -(void)getFileListFromSpecifiedParentFolder { GTLQueryDrive *query2 = [GTLQueryDrive queryForChildrenListWithFolderId:<some_id or root>]; query2.maxResults = 1000; // queryTicket can be used to track the status of the request. [self.driveService executeQuery:query2 completionHandler:^(GTLServiceTicket *ticket, GTLDriveChildList *children, NSError *error) { NSLog(@"\nGoogle Drive: file count in the folder: %d", children.items.count); //incase there is […]

IOS:如何使用ios google drive sdk API下载Google Docs文件?

我集成谷歌drivs sdk与我的iOS应用程序。 目前正在使用下面的代码,从我的谷歌驱动器的A / C下载url链接下载文件。 但是,当我尝试下载谷歌文档文件(其中有MIMEtypes的应用程序/ vnd.google-apps.document )没有从谷歌驱动器库下载URL链接。 在这种情况下,我怎么能下载谷歌文档数据? 我可以使用alternateLink而不是下载url链接? 任何帮助,必须感激。 我的代码: – (void)loadFileContent { GTMHTTPFetcher *fetcher = [self.driveService.fetcherService fetcherWithURLString:[[self.driveFiles objectAtIndex:selectedFileIdx] downloadUrl]]; [fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError *error) { if (error == nil) { NSLog(@"\nfile %@ downloaded successfully from google drive", [[self.driveFiles objectAtIndex:selectedFileIdx] originalFilename]); //saving the downloaded data into temporary location } else { NSLog(@"An error […]