如何在 ios 中使用 Facebook 分页

How to use facebook pagination in ios

您好,我最近开始为 iOS.I 编写代码,我正在尝试使用以下代码从 Facebook 获取视频。

-(void)facebookGetVideos:(UIViewController*)vc completionHandler:(void (^)(NSMutableArray*))completionBlock{
   __block NSMutableArray * itemArray;
    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]

                                  initWithGraphPath:@"me/videos/uploaded"

                                  parameters:@{@"fields":@"source,description,thumbnail,title"}

                                  HTTPMethod:@"GET"];

    [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                          id result,

                                          NSError *error) {
        if(error!=nil){
             NSLog(@"Error after fb dwnld %@",error);
            [MBProgressHUD hideHUDForView:vc.view animated:true];
            [self showAlert:@"Error" message:error.localizedDescription viewController:vc];
        }else{

            NSLog(@"Results %@",result);
             itemArray = [[NSMutableArray  alloc]init];
           // [itemArray addObject:[result valueForKey:@"data"]];
            itemArray =[result valueForKey:@"data"];

             completionBlock(itemArray);
        }
    }];

}

我从那里得到的回复如下:-

{
    data =     (
                {
            id = 1845903302379295;
            source = "https://video.xx.fbcdn.net/v/t43.1792-2/27475816_220074475216744_8742438766032977920_n.mp4?efg=eyJybHIiOjE1MDAsInJsYSI6MTAyNCwidmVuY29kZV90YWciOiJzdmVfaGQifQ%3D%3D&rl=1500&vabr=382&oh=d4c3f6028a979c5919fdd8e444e24179&oe=5A89882A";
        },
                {
            id = 1814936632142629;
            source = "https://video.xx.fbcdn.net/v/t42.14539-2/23925286_2650490725061654_2502749796398268416_n.mp4?efg=eyJybHIiOjU3NiwicmxhIjo1MTIsInZlbmNvZGVfdGFnIjoic2QifQ%3D%3D&rl=576&vabr=320&oh=2fde1aea6eff33d8139ccb8fe7a33fd4&oe=5A8980C0";
        }
    );
    paging =     {
        cursors =         {
            after = MTgxNDkzNjYzMjE0MjYyOQZDZD;
            before = MTg0NTkwMzMwMjM3OTI5NQZDZD;
        };
    };
}

我想在 before 之后使用它作为参数,如下所示:-

-(void)afterValues:(NSString*)afterVal{


    NSDictionary * parameters =@{@"fields":@"source",@"after": afterVal};
    FBSDKGraphRequest *request1 = [[FBSDKGraphRequest alloc]
                                   initWithGraphPath:@"me/videos/uploaded"
                                   parameters:parameters
                                   HTTPMethod:@"GET"];
    [request1 startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                           id result,
                                           NSError *error) {

        NSLog(@"after videos%@",result);


    }];
}

并得到以下响应:-

after videos{
    data =     (
    );
}

任何人都可以指出我的 mistake.Any 类型 help/suggestion 或在这方面的指导会非常 appreciated.Thanks 提前!

您是否通过登录对话框请求了相应用户的 manage_pages 权限?我认为您看到的结果是空的,因为缺少权限。