Reputation: 6680
I am posting a post on the current user feed with the following code:
NSMutableDictionary *postParams = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
@"http://url.com/image.jpg", @"picture",
@"The title of the post on the feed", @"name",
@"Caption text", @"caption",
@"Description text", @"description", nil];
[self.facebook requestWithGraphPath:@"me/feed" andParams:postParams andHttpMethod:@"POST" andDelegate:nil];
It works great but I can't figure out how to setup the link behind the name of the post ("The title of the post on the feed"). For now the link looks like the following :
https://www.facebook.com/connect/uiserver.php?app_id=[MY_APP_ID]&method=permissions.request&redirect_uri=[THE_URL_OF_THE_PICTURE]&response_type=code&display=page&auth_referral=1
Is there a way to control this url easily? Thanks!
-- EDIT --
Here is a screenshot of a kind of post I want to create :
http://cl.ly/image/020D1z3S2L16. The link behind the blue title "Je t'ai envoyé un défi dans Années 80" is really clean (just like http://itunes.apple.com/app/[APP_NAME]) and I'd like to do the same.
I believe this not an open graph action, just a basic post. Thanks
Upvotes: 3
Views: 1305
Reputation: 1218
Hey Its very easy just try this code.
NSMutableDictionary *params = [NSMutableDictionary dictionary] ;
[params setObject:@"Test post" forKey:@"message"];
[params setObject:@"link" forKey:@"type"];
[params setObject:@"http://yoursite.com" forKey:@"link"];
[params setObject:@"Link description" forKey:@"description"];
// Make the request
[FBRequestConnection startWithGraphPath:@"/me/feed"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
if(appDelegate.isLoggedInWithTwitter)
{
[self postMessage:_lblTitle.text];
}
else
{
[self toggleProgressHud:NO title:@"" message:@""];
NSLog(@"%@",[NSString stringWithFormat:@"result: %@", result]);
UIAlertView *alertMsg=[[UIAlertView alloc]initWithTitle:nil message:@"Shared Successfully" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok", nil];
alertMsg.tag=11;
alertMsg.delegate=self;
[alertMsg show];
}
// Link posted successfully to Facebook
} else {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(@"%@",[NSString stringWithFormat:@"%@", error.description]);
[self toggleProgressHud:NO title:@"" message:@""];
[self handleAPICallError:error];
}
}];
And here is the result which you want
Upvotes: 2
Reputation: 6680
"xx shared a link" cannot be controlled through a post. Facebook is performing tons of A/B testing to decide what to display...
Upvotes: 1
Reputation: 96397
For now the link looks like the following :
https://www.facebook.com/connect/uiserver.php?app_id=…&method=permissions.request&…
That sounds like you’ve got Authenticated Referrals enabled in your app settings …?
That would explain, why the link points to the Facebook URL with a parameter method=permissions.request
embedded.
If so, and that’s not what you want – then turn of Authenticated Referrals.
Upvotes: 1
Reputation: 73908
All parameters of the Facebook feed are outlined in the Graph API reference, https://developers.facebook.com/docs/reference/api/post/.
The relevant ones are "name", "caption", "description" or "message". Therefore, if whatever is the element you are referring to is not affected, you don't have control over it.
Upvotes: 2