Facebook Graph api wall post not as link - facebook

Using the graph api I can post to a users wall:
[[NSMutableDictionary alloc] initWithObjectsAndKeys:
#"https://developers.facebook.com/ios", #"link",
#"http://www.xmaselves.co.uk/wp-content/uploads/2012/05/gym.png", #"picture",
[self getTitleText], #"name",
[self getCaptionText], #"caption",
[self getFbFormattedDescription], #"description",
_comment.text, #"message",
nil];
[FBRequestConnection
startWithGraphPath:#"me/feed"
parameters:postParams
HTTPMethod:#"POST" .... etc
The problem is this only seems to post on the wall as a link:
I want the post to appear as normal and not as a 'shared a link' post. How do achieve this with the graph api.
EDIT
Removing the link paramater and making sure #message is specified will indeed post to the wall.
If you remove the link paramater and do not specify message nothing is posted and no error is returned!
In the screenshot 'asdadasd' would be the user entered message but this is optional! So if they don't enter a message the post wont be displayed! As a matter of fact this same behaviour is exhibited by the 'Feed dialogue' api.
So all posts need to have a message? or posted as a link? This doesn't seem right.

Related

Facebook permissions required to tag a friend in a wall post..?

I want to tag a friend in a post which I am posting on my wall , just wanted to know what permissions are required...?
I am using the following code...
For permissions..
NSArray *permissions = [[NSArray alloc] initWithObjects:
#"friends_online_presence",
#"read_stream",
#"email",
#"publish_stream",
nil];
[self.appDelegate.facebook authorize:permissions];
[permissions release];
and to post
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Test 2",#"message",
#"100004311843201,1039844409", #"to",
nil];
[self.appDelegate.facebook requestWithGraphPath:#"me/feed" andParams:params andHttpMethod:#"POST" andDelegate:self];
This gets posted on wall successfully but the profile ids are not included...
Though its in PHP here is bug report which says it is problem in Graph API while posting status update and tagging friends is not working properly.
It says that it will post status update but tagging is not working.
EDIT:
As discussed with OP in comments, adding place field attached to parameters it is working.
I think this should help you:
To mention a user in a user message, place this string inline with the message: #[userID] or #[profileUrl]. This creates an inline hyperlink to the profile of the mentioned friends and sends them a notification that they have been tagged.
Taken from: https://developers.facebook.com/docs/technical-guides/opengraph/mention-tagging/
For tag friends in Facebook friends id are required to tag in post etc.
customer friend picker is better for tag friends.
see below Facebook sample
https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/851564_497226807066458_2037734970_n.png
for this purpose us this graph api taggable_friends to get tag able friends
for more detail visit this link and read tag section (Mention Tagging is suite for your requirements)
mentiontagging detail info

How to limit facebook apprequests to certain users?

I have a iOS mobile application that needs to send out an app request to a user's friends. From here:https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk and here:https://developers.facebook.com/docs/reference/dialogs/requests/#mfs it appears I am able to suggest the users that this app requesst gets sent to. I am making the call like this:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Check out this awesome app", #"message",
#"1xxx4,10xxxx0,", #"suggestions",
nil];
[self.facebook dialog:#"apprequests"
andParams:params
andDelegate:nil];
However, once the multi-friend request dialog is presented, I am still able to type in a friends name, even if it was not part of the "suggestions". How do I make this restriction?
The end goal is to restrict that list to facebook friends who are not users of this app. The docs also mention a "filters" parameter, but i have not got that to work.
Ideas?

Posting to message Facebook from iPhone/iPad

I have a 2-part question about posting messages to Facebook.
1 - I want to pre-populate the message that the user is going to post i.e. where it says 'Say something about this...'. Is this possible? If so, how? At the moment I have the following setup to produce the post shown below:
NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Steak Expert", #"name",
#"The must-have iPhone/iPad app for carnivores!", #"caption",
#"Steak Expert helps you to cook every steak to perfection! With this app in your hand you'll never need to worry about over-cooking or under-cooking a steak again. Perfection every time! ", #"description",
#"https://m.facebook.com/apps/MY_APP_ID/", #"link",
#"http://fbrell.com/f8.jpg", #"picture",
#"Cooking a steak using Steak Expert!", #"message", // I thought this would be the required field to populate the text
nil];
[facebook dialog:#"feed" andParams:params andDelegate:nil];
2 - The other part of my question is based around the view shown above. Is it possible to automatically post to the wall without the need for this view to appear? Seeing as the user must authorise the app to even connect with Facebook (plus any other specified actions) I can't see it being an issue. If so please could someone advise on how to achieve this?
It is the message field that you are talking about.
message - This field will be ignored on July 12, 2011 The message to prefill the text field that the user will type in. To be compliant with Facebook Platform Policies, your application may only set this field if the user manually generated the content earlier in the workflow. Most applications should not set this.
http://developers.facebook.com/docs/reference/dialogs/feed/
Hope this helps
As #Illep stated, the message field no longer works for the dialog postings.
To answer your second question, you can use the graph API to straight post to a user's wall without showing the dialog box. Take a look at the documentation here. You would use the following code to write the message:
// Set parameters
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setObject:FACEBOOK_ACCESS_TOKEN forKey:#"access_token"];
[params setObject:#"Some preset message" forKey:#"message"];
// Make the request to the graph API
[_facebook requestWithGraphPath:#"me/feed" andParams:params andHttpMethod:#"POST" andDelegate:self];

how to post a photo and message to Facebook using the new Facebook GRAPH API on iPhone

I know how to post an image using the GRAPH API and I know how to post a comment using the same. But I can't figure out how to post a photo and allow the user to also include a message/status with the photo (all posting on the user's own wall).
This is the code that I am using to upload a photo from my app to user's wall. The GRAPH API does not define what other keys I can specify in the param dictionary.
-(void) uploadPhotoToFacebook {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
imageView.image, #"picture", nil];
[facebook requestWithGraphPath:#"me/photos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
}
I have found ways to do this using the now deprecated Facebook API but that doesn't help me.
Thanks for the help,
// Post a status update along with picture via the Graph API, and display an alert view
with the results or an error.
NSString *message = #"This is status Message!";
UIImage *image = [UIImage imageNamed:#"myPngImageToPost"];
NSDictionary *params = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:message, UIImagePNGRepresentation(image), nil] forKeys:[NSArray arrayWithObjects:#"message", #"picture", nil]];
// use the "startWith" helper static on FBRequest to both create and start a request, with
// a specified completion handler.
[FBRequest startWithGraphPath:#"me/photos"
parameters:params
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
[self showAlert:message result:result error:error];
}];
The above code will show status update as well as image below your status message.
The documentation is here: http://developers.facebook.com/docs/reference/api/photo/ ... along with the restrictions and required permissions. I have been wrestling with it for a few days since not everything I expect to work works! For posting you want to use the "source" key instead of picture which refers to the thumbnail.
Posting on the wall (feed dialog) and comments (graph photo/comment) (comments and tags are adding connections) are all separate transactions. For posting, I'm struggling with it since I can post a photo by providing an existing URL from another website but for some reason, I cannot point use the photo link from the picture I just posted (the feed dialog appears without any photo).

Publishing links to user's wall using Facebook iOS SDK

I'm trying to publish a link to the user's wall on Facebook after he has already logged in using the new Facebook iOS SDK.
I want the link to behave as if the user posted it from his account. For example, if I post this link on my Facebook wall: http://www.apple.com/, I won't see the link. What I'll see is an image, a caption with the actual url and a short description. But when I publish this same link from my app, all I see is the link itself.
How can I publish this url through my app so that what will eventually appear on the user's wall is the formatted message as it would appear if he would have posted it from his account on the pc, and not just the link itself as a string?
Thanks,
EDIT: The code below is for an OLD version of the FB SDK
Check here for a more up to date answer that may help Facebook sdk post on wall on iPhone app
OLD POST:
From http://developers.facebook.com/docs/reference/dialogs/feed/
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, #"app_id",
#"http://developers.facebook.com/docs/reference/dialogs/", #"link",
#"http://fbrell.com/f8.jpg", #"picture",
#"Facebook Dialogs", #"name",
#"Reference Documentation", #"caption",
#"Dialogs provide a simple, consistent interface for apps to interact with users.", #"description",
#"Facebook Dialogs are so easy!", #"message",
nil];
[_facebook dialog:#"feed" andParams:params andDelegate:self];
You need to use FBStreamDialog for this. I do not have the exact code. Try this:
FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.delegate = self;
dialog.userMessagePrompt = #"What's in your mind?";
dialog.attachment = #"{\"name\":\"Apple URL","
"\"href\":\"http://www.apple.com\","
"\"caption\":\"App Name\",\"description\":\"Posting link Test\","
"\"media\":[{\"type\":\"image\","
"\"src\":\"http://www.apple.com\","
"\"href\":\"http://www.apple.com\"}],"
"\"properties\":{\"another link\":{\"text\":\"Apple home page\",\"href\":\"http://www.apple.com\"}}}";
[dialog show];