How to Comment or Like a Photo in Facebook Through Fbconnect or Graph API in iPhone Sdk

How to comment or like a photo in facebook through FBconnect or Graph API in iPhone SDK?

To "Like" a Photo (or everthing else with an ID) just post your Acces-Token to the Graph API, e.g. your photo has the ID 123456789. So you have to post your Access-Token to https://graph.facebook.com/123456789/likes.

To comment on a Photo do the same, but post a message (as a parameter) to the Graph API, e.g. https://graph.facebook.com/123456789/comments.

In Code call the following method (defined in Facebook.h) with your path and no parameters for "Like" and a message as a parameter for "Comment":

-(void) requestWithGraphPath:(NSString *)graphPath 
andParams:(NSMutableDictionary *)params
andHttpMethod:(NSString *)httpMethod
andDelegate:(id <FBRequestDelegate>)delegate

Note, that the httpMethod should be "POST" and the Facebook iOS SDK automaticaly adds your Access-Token.

For more information read the "Publishing" part on: http://developers.facebook.com/docs/reference/api

Edit:
Like deanWombourne wrote in the comments: Just post an NSMutableDictionary like this

[NSMutableDictionary dictionaryWithObjectsAndKeys:@"This is my comment", @"message", nil];

for the comments or an empty NSMutableDictionary like:

[NSMutableDictionary dictionary]

if you want to like a post.

The response from the Facebook servers should be result = true.

How to like and comment on facebook through Graph API in iPhone?

Please refer to my answer here: How to comment or like a photo in facebook through FBconnect or Graph API in iPhone SDK?

Just post your Access Token to https://graph.facebook.com/ID_OF_THE_POST/likes or your Access Token and the Message as a parameter to https://graph.facebook.com/ID_OF_THE_POST/comments.

For more info see the "Publishing" part in the Facebook Documentation: http://developers.facebook.com/docs/reference/api

Like a post on a Facebook page

Refer here - How to "like" and "comment" on facebook through Graph API in iPhone?

Please refer to my answer here: How to comment or like a photo in facebook through FBconnect or Graph API in iPhone SDK ?

Just post your Access Token to
https://graph.facebook.com/ID_OF_THE_POST/likes or your Access Token
and the Message as a parameter to
https://graph.facebook.com/ID_OF_THE_POST/comments.

For more info see the "Publishing" part in the Facebook Documentation:
http://developers.facebook.com/docs/reference/api

Source: https://stackoverflow.com/users/432565/audience

How to get photos of a facebook album in iPhone SDK?

So /me/albums returns an array of Album objects, each of which has an id.

If an album had an id of 99394368305, you can go to

https://graph.facebook.com/99394368305/photos

to get an array of photo objects.

Each of these will have the picture and source properties to get the image data from facebook.

They will all have an images array as well if you want pre-scaled images instead of just the originals.


All the facebook queries give JSON back - I'm assuming that you know how to parse this?

How to like facebook community in iphone using graph API

As of now Facebook doesn't allow you to like anything apart form posts through Graph API. We actually had a work around using webview to display Facebook Like button.

You can refer to this great post by Ray Wenderlich at http://www.raywenderlich.com/1626/how-to-post-to-a-users-wall-upload-photos-and-add-a-like-button-from-your-iphone-app

and customize your like button at http://developers.facebook.com/docs/reference/plugins/like-box

Hope it helps.

How to comment and Like on friends wall through FBGraph API?

Documentation with examples on how to do this is at at http://developers.facebook.com/docs/api/.

You need to

  • authenticate (get an access token)
  • know your friend's ID
  • do an HTTP POST to the right URL to create posts or like existing posts.

The section labelled "Publishing" on the aforelinked documentation page shows how to do this.

Post to user's Facebook wall with iPhone using latest FBConnect SDK

Have you looked at DemoApp under the sample directory in facebook-ios-sdk? There's a publishStream method that might help.

Or, you can use

- (void)requestWithGraphPath:(NSString *)graphPath
andParams:(NSMutableDictionary *)params
andHttpMethod:(NSString *)httpMethod
andDelegate:(id <FBRequestDelegate>)delegate;

like this:

[_facebook requestWithGraphPath:@"[user_id]/feed" 
andParams:[NSMutableDictionary dictionaryWithObject:@"test wall post" forKey:@"message"]
andHttpMethod:@"POST"
andDelegate:self];

to post a comment to [user_id]'s wall.



Related Topics



Leave a reply



Submit