Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.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
Ios 从Facebook graph api获取用户共享的视频数据_Ios_Objective C_Facebook Graph Api - Fatal编程技术网

Ios 从Facebook graph api获取用户共享的视频数据

Ios 从Facebook graph api获取用户共享的视频数据,ios,objective-c,facebook-graph-api,Ios,Objective C,Facebook Graph Api,我正在我的应用程序中使用Facebook graph api。我想获取用户发布的视频。当我登录时,我会得到基本信息。但当我查询帖子时,我只在结果中得到id。 我的代码是: -(void)getPosts { NSMutableDictionary *par = [[NSMutableDictionary alloc]init]; [par setObject:@"posts" forKey:@"fields"]; [FBRequestConnection startWithGraphPath

我正在我的应用程序中使用Facebook graph api。我想获取用户发布的视频。当我登录时,我会得到基本信息。但当我查询帖子时,我只在结果中得到id。 我的代码是:

-(void)getPosts {

NSMutableDictionary *par = [[NSMutableDictionary alloc]init];
[par setObject:@"posts" forKey:@"fields"];

[FBRequestConnection startWithGraphPath:@"me"
                             parameters:par
                             HTTPMethod:@"GET"
                      completionHandler:^(
                                          FBRequestConnection *connection,
                                          id result,
                                          NSError *error
                                          )
 {
     //handle the result
     if(!error)
     {
         NSLog(@"%@",result);
     }
     else
     {
         NSLog(@"%@",[error localizedDescription]);
     }
 }];

}

如果我做错了或遗漏了什么,请帮助我。通过facebook开发API的引用,提前感谢

您已使用以下方法登录用户视频:

/* make the API call */
[FBRequestConnection startWithGraphPath:@"/me/videos"
                             parameters:nil
                             HTTPMethod:@"GET"
                      completionHandler:^(
                          FBRequestConnection *connection,
                          id result,
                          NSError *error
                      ) {
                          /* handle the result */
                      }];

您需要设置<强> UrSyViels的第一权限,如PAR DOC所说:

需要具有user\u videos权限的用户访问令牌才能查看该用户标记的或已上载的所有视频

这里是示例代码:

1)以下是获取用户上传视频的基本逻辑…(显示用户发布到Facebook的所有视频)

注意:这将提供用户上传的视频。

2)并且如果您还希望在视频列表中添加用户标签(显示所有视频用户被标记在其中),则在这种情况下

/* make the API call */
    [FBRequestConnection startWithGraphPath:@"me/videos"
                                 parameters:nil
                                 HTTPMethod:@"GET"
                          completionHandler:^(
                              FBRequestConnection *connection,
                              id result,
                              NSError *error
                          ) {
                              /* handle the result */
                               arrFbUserTagVideos= [result objectForKey:@"data"]; //get all data in NSMutableArray
                          }];
注意:这将给出用户被标记的视频。


当我使用这个时,我得到的数据=();作为响应,使用上述方法替换您的方法,并在登录时设置权限我如何在登录时设置权限。当我在viewDidLoad As中设置权限时,loginView.readPermissions=@[@“public_profile”、@“email”、@“user_friends”、@“user_likes”、@“user_videos”、@“user_photos”];有了上述权限,只需添加一个
user\u视频
,并对在Facebook上共享视频的用户进行“是”测试,否则您无法重新检查我从链接下载的示例代码我只需更新我的答案。如何将Facebook页面上的视频显示到我的IOS应用程序?
/* make the API call */
    [FBRequestConnection startWithGraphPath:@"me/videos"
                                 parameters:nil
                                 HTTPMethod:@"GET"
                          completionHandler:^(
                              FBRequestConnection *connection,
                              id result,
                              NSError *error
                          ) {
                              /* handle the result */
                               arrFbUserTagVideos= [result objectForKey:@"data"]; //get all data in NSMutableArray
                          }];