I am using this following Graph API request to get all friends who likes a specific object:
me/?fields=friends.fields(likes.target_id(searched_object_id))
iOS code is as follow:
[ FBRequestConnection startWithGraphPath: [ NSString stringWithFormat: @"me/?fields=friends.fields(name,likes.target_id(%lld))", 7919071058 ]
completionHandler: ^(FBRequestConnection *connection, id result, NSError *error) {
[ [ [ result objectForKey: @"friends" ] objectForKey: @"data" ] enumerateObjectsUsingBlock:^(id friend, NSUInteger idx, BOOL *stop) {
if ( [ friend objectForKey: @"likes" ] )
NSLog( @"%@ also likes that", [ friend objectForKey: @"name" ] );
} ];
}
];
I’d like to do the same with og.likes unfortunately .target_id is not available
For information og.likes are open graph object you can declare in your app.(https://developers.facebook.com/docs/opengraph/tutorial/)
Thanks by advance for your help
Here follow modified code to work with og.likes
As you can see, i had to grab every og.likes of my friends then iterate through them to find matching one. It is more bandwidth but it works.
If anyone find a more elegant way, i am still curious about it.
Regards