Facebook FQL and Graph API in Xcode returning a single video
I am trying to do a simple query to get a list of all videos in my Facebook account. The FQL query in FQL console (or Graph API console) on Facebook returns the correct number of videos. However, when executing the query (GraphAPI or FQL) from Objective C returns just a single record (video).
On Facebook FQL console:
SELECT vid, owner, title, description, updated_time, created_time FROM video WHERE owner=me()
In Objective C (using Facebook's Wishlist sample code):
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"SELECT vid, owner, title, description, updated_time, created_time FROM video WHERE owner=me()", @"query", nil]; NSLog(@"FQL: %@", params); [facebook requestWithMethodName:@"fql.query" andParams:params andHttpMethod:@"POST" andDelegate:self];
When I print the "result" in request:didLoad, it contains just a single video. I am not sure what is causing the problem. Any help will be appreciated.
This code will get you all the videos that are on your Facebook account, including the ones that you have been tagged in:
NSString *requestPath = @"/me/videos?fields=name,from,description,updated_time,created_time"; [facebook requestWithGraphPath:requestPath andDelegate:self];
I personally only use fql when I have to do multiple queries in a single request. Thats not necessary in this case.
To get the videos that only you yourself have uploaded, you will have to make a request to /me/videos/uploaded instead.
The requested fields above are taken from the video object documentation: https://developers.facebook.com/docs/reference/api/video/
I hope this helps!