Reputation: 83
I am using Facebook graph api in my app. I want to get user's posted videos. When I login I get basic info. But when i query about posts i only get id in result. My code is:
-(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]);
}
}];
}
Please help if I am doing wrong or missing something. Thanks in advance
Upvotes: 0
Views: 1150
Reputation: 15951
1) Here is a basic logic to get User's uploaded video...(shows all videos that were published to Facebook by user)
/* make the API call */
[FBRequestConnection startWithGraphPath:@"me/videos/uploaded"
parameters:nil
HTTPMethod:@"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
arrFbUserUploadVideos= [result objectForKey:@"data"]; //get all data in NSMutableArray
}];
Note: This will give the video Uploaded by the user..
2) and if you also want video list in which User tag (shows all videos use person is tagged in) in that case
/* 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
}];
Note: This will give the video in which user is tag..
Upvotes: 1
Reputation: 49710
with the referance from facebook dev API
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/videos
you got Logged in User Video using this method:
/* make the API call */
[FBRequestConnection startWithGraphPath:@"/me/videos"
parameters:nil
HTTPMethod:@"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
}];
You need to set first Permission of user_videos as par doc said:
A user access token with user_videos permission is required to see all videos that person is tagged in or has uploaded.
HERE IT IS SAMPLE CODE:
http://www.filedropper.com/fblogin
Upvotes: 1