like/comment on news feed programmatically through Facebook iOS Sdk iphone - iphone

I have integrated Facebook IOS SDK to my application and able to post news feed to user's wall programmatically in facebook. Now there is other requirement like in facebook we have options under each news feed of like/comment. I searched a lot for this but was not able to find anything related to this.
I am able to read the news feed from the user's wall and I have it in JSON format. I don't know the further implementation path for the same.
How can we achieve this functionality through iOS sdk?

No worries. With Legacy Rest API of facebook, I figured out how to Comment particular news feed.
//How to Like particular News FEED.
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:#"Your Comment Text.", #"text",#"NEWs_FEED_ID", #"object_id",nil];
[_facebook requestWithMethodName:#"comments.add" andParams:params andHttpMethod:#"POST" andDelegate:self];
//How to Like particular News FEED.
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:#"NEWs_FEED_ID", #"post_id",nil];
[_facebook requestWithMethodName:#"stream.addLike"

Related

Workaround to Post in a friend wall after Graph API feature is deprecated

My iOS app is trying to post to a friend's timeline. I was using the Graph API, but it's seems from what I read at Platform Updates: Operation Developer Love of February that is now deprecated and you can't post on a friends wall using that. Without this feature the social part of my app will be very weak. So, I did some research and found that using some deprecated headers you still can publish on a friends feed (http://developers.facebook.com/docs/howtos/publish-to-feed-ios-sdk/). After doing all the code, I'm just missing a small part that I can't found anywhere that is how can I set a default text to this Facebook Dialog? Or if someone has another way to do it without using these deprecated stuff please share...
Thanks
// Put together the dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
friendID,#"to",
#"Facebook SDK for iOS", #"name",
#"Build great social apps and get more installs.", #"caption",
#"The Facebook SDK for iOS makes it easier and faster to develop Facebook integrated iOS apps.", #"description",
#"https://developers.facebook.com/ios", #"link",
#"https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png", #"picture",
nil];
// Invoke the dialog
[self.facebook dialog:#"feed" andParams:params andDelegate:self];

iPhone App Send Facebook Message or Post to Friend's Walls

Here is my current setup. I can click a button and post an image and a comment or news story directly to my wall, mainly just doing some simple FBConnect or ShareKit options.
I would like to expand this to something more complex and engrossing/useful. I would like to be able to take a comment or news story, and either send it in a message to someone on Facebook, or post it to any of my friend's walls.
I believe I will need to use Facebook Open Graph to accomplish this, but am unsure of where to begin. I do have an App setup in Facebook, though it is essentially just for the purpose of SSO with my apps. Could someone direct me to a good tutorial to do what I would like and/or guide me through getting my app set up in Facebook, and then some suggestions for integrating with iPhone?
For posting on Friend's wall, you can use FB's graph api. Here you go with the minimal code snippet for publishing something on friend's wall:
NSMutableDictionary* params = [NSMutableDictionary dictionary];
[params setObject:#"Some text" forKey:#"user_message_prompt"];
[params setObject:#"another text" forKey:#"action_links"];
[params setObject:#"Yet another text" forKey:#"attachment"];
[params setObject:#"SOME FACEBOOK ID" forKey:#"target_id"];
//At some point you need to create the following Facebook instance
[facebook dialog: #"stream.publish" andParams: params andDelegate: self];

Facebook API Post Message On Friends Wall

I want to ask how to implement text view in Facebook API. I want to post message on friends wall and also how to get friends list and personal details from Facebook.
You have to use the IOS Facebook API. They created a quite detailed Introduction page.
Have a look here:
https://developers.facebook.com/docs/mobile/ios/build/
This image shows the whole process from authorization till publishing something on the news feed. (Also copied from the Facebook Developer tutorial)
Describing the process to get the friend list:
Facebook Api to check in users in an iOS app
Due to many of errors and many of negative comment about Open Graph API in facebook ios 6.
facebook remove the " Post to friends wall via the API ". You can only use the fbconnect of ios 5.
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"100004925467891", #"to",
#"http://pri.com/pit.png", #"picture",
#"http://pr.com", #"link",
#"Data", #"caption",
#"data",#"description",
#"Birthday Reminder",#"name",nil];
[[delegate facebook] dialog:#"feed" andParams:params andDelegate:self];
But if u Post to own wall Open Graph API is still working.

Is it possible to post a message on the wall without a dialogue in iphone app using fbconnect?

I'm using facebook connect for my iphone application. I need to be able to post messages on the wall WITHOUT USING PROMPTING DIALOGUES. All i wanna do is enter text into a textfield and then post the text on the wall by clicking a button. Is it possible to implement this?
This is explained in the tutorial here.
https://developers.facebook.com/docs/mobile/ios/build/#socialchannels
If you DON"T want to use dialogs then you need this.
http://developers.facebook.com/docs/reference/iossdk/request/
http://developers.facebook.com/docs/reference/rest/#publishing-methods
Also see this answer: iOS Development: How can I get a Facebook wall post to show in the friend's news feed?
I'm assuming that you have successfully authenticated the facebook and you have a valid object of facebook.
NSString *message = [yourTextField text];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:message, #"message",nil];
[facebook requestWithGraphPath:#"me/feed" andParams:params andHttpMethod:#"POST" andDelegate:self];

How to post both text, image and link at once on friends' walls via facebook API

How to let someone post on his/her friends' walls via facebook API, similar to instagr.am iPhone application lets you post on your own wall?
How to show a list of friends and allow selecting them?
How to post both text, image and link at once?
As it happens, Facebook has an iOS SDK available, and instructions on how to use that to post feed items (either with an interactive dialog, or with their Graph API).
i did this way. it works fine.. u can post for multiple frnds as well.
NSMutableDictionary* params1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
<appId>, #"api_key",
#"Happy Birthday....", #"message",
#"http://www.youtube.com/watch?v=wFh-rX_Sfhs", #"link",
#"http://www.99desi.com/wp-content/uploads/2011/03/Happy-Birthday.jpg", #"picture",
#"Many More Happy returns Of the Day...", #"name",
#" Believing hear, what you deserve to hear..", #"description",nil];
[facebook requestWithGraphPath:#"<frnd-ID>/feed" andParams:params1 andHttpMethod:#"POST" andDelegate:self];
u can iterate the above step to post same to multi friends.
hope it helps you...