Facebook API Post Message On Friends Wall - iphone

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.

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];

Facebook publish_actions to timeline for iOS

After searching Facebook developer documentation / bugs, and questions on stackoverflow.com, it's not clear if Facebook now supports publish_actions to timeline via it's iOS SDK. There are some questions here on this site that relates to publish_actions permission on mobile, but they don't provide any solution.
Has Facebook rolled out publish_actions for mobile for all third party apps or is it still restricted to devs?
Does Facebook allows publishing actions to timeline via it's publish_actions permission via iOS SDK?
Are there any examples, sample code, or tutorials that explain how to achieve it on iOS?
I'd appreciate any pointers.
Yes. Publishing actions works from within iOS just like it works on the Desktop Web, Mobile Web and from within Android.
The method of requesting the publish_actions permission is the same is uses to request any other permission.
The method of publishing actions is the same Graph API call as you make from any platform:
POST https://graph.facebook.com/me/APP_NAMESPACE:ACTION_NAME?OBJECT_NAME=OBJECT_URL&access_token=TOKEN
for example
POST https://graph.facebook.com/me/myapp:cook?recipe=http://exmaple.com/recipe&access_token=TOKEN
In Objective C you might have something like
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[[delegate facebook] requestWithGraphPath:#"me/myapp:cook" andParams:#"http://exmaple.com/recipe" forKey:#"recipe"] andHttpMethod:#"POST" andDelegate:self];
I cannot make this work. I have already got my action released by Facebook so sample had been sent from CURL, but from IOS I always get back domain error 1000.
Here is my code:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"http://itunes.apple.com/us/app/ginos-challenge/id509946175",#"og.url",
#"Played on Gino's challenge",#"og:title",
#"http://media.appspy.com/thumbs/images/icons/i509946175_jpg_180x180_q85.jpg",#"og:image",
#"This is my first post",#"og:description",
#"1000", #"game_point",
nil];
// Publish.
// This is the most important method that you call. It does the actual job, the message posting.
[facebook requestWithGraphPath:#"me/[action domain]:[action name]" andParams:params andHttpMethod:#"POST" andDelegate:self];
No, publish_action will not support for posting in timeline. You should add a new tag like fb:explicitly_shared. Set this as BOOL value. If you set true, it will show in the user's timeline, else it will not.

like/comment on news feed programmatically through Facebook iOS Sdk 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"

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...

iOS Development: How can I get a Facebook wall post to show in the friend's news feed?

I'm integrating Facebook into my iPhone app and I have the code working to publish a post to the user's wall after they login, but I've noticed that the post doesn't show up in the user's news feed that's seen by the user's friends. Instead, it only shows up on the wall of the user. Here's my code...
- (void)publishStream
{
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Post a message on your wall", #"user_message_prompt",
#"Hello, World!", #"message",
nil];
[facebook dialog:#"feed"
andParams:params
andDelegate:self];
}
How can I have it show up in the news feed as well? I should mention that the only permission I have set is 'publish_stream' which, as I understand it, is the only permission I need.
Thanks so much for your wisdom!
You need to post to your friends feed, Easy way would be to adapt your code to use the appropriate graph method with the persons you wish to post to facebook ID (i've assumed here you have stored this from an earlier call the graph api in person.facebookID)
[facebook requestWithGraphPath:[NSString stringWithFormat:#"%#/feed/",person.facebookID] andParams:params andHttpMethod:#"POST" andDelegate:self
http://developers.facebook.com/docs/reference/api/post
To get a list of the users friends use the graph path me/friends
[facebook requestWithGraphPath:#"me/friends" andDelegate:self];
Which will return a JSON list of the users friends names and their Facebook ids, to the appropriate delegate method from FBRequest, its probably worth wrapping this set of results into a set of person objects or storing the returned NSDictionary so that you can retrieve individual friends, its upto you how you process the list of returned friends (you probably want to use a UITableView to display the user friends or filter based on some other input from the user)
Using this method will mean you do not have to use the Facebook dialogs in the iOS sdk, which does mean there is an upper limit to how many messages the user can post in a day using your app
If you wish to use a dialog you will need to include the "target_id" in your params dictionary and set this to the persons Facebook ID you wish to post to