1

I'm using the following code to publish an action onto the Open Graph from my iPhone application:

-(void) postEarnedBadgeToFacebook:(id)delegate:(Badge*)theBadge
{
    NSLog(@"Posting badge [%@] to facebook", theBadge.badgeTitle);

    NSMutableDictionary * params = [[NSMutableDictionary alloc]init];
    [params setValue:[theBadge getFullyQualifiedFacebookWebPageUrl] forKey:@"badge"];
    [params setValue:[theBadge getFullyQualifiedFacebookWebImageUrl] forKey:@"image"]; 

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NSLog(@"Posting graph request for me/myapp:earn");
    [[appDelegate facebook] requestWithGraphPath:@"me/myapp:earn" andParams:params andHttpMethod:@"POST" andDelegate:self];
}

This works perfectly fine, and I'm able to see invocations of the above in the activity log of my facebook profile like so :

enter image description here

Question : Although my apps' actions show in the activity feed, is there a way I can automatically have them show on the users timeline? At the moment, the user would manually have to click on the option circled in green, and select "show on timeline"

2 Answers 2

1

Check My Answer and see more about Document about Explicit Sharing :

id<FBOpenGraphAction> action = (id<FBOpenGraphAction>) [FBGraphObject graphObject];
[action setObject: @"true" forKey: @"fb:explicitly_shared"];  // The key point!
2
  • 1
    You need to remember to enable the 'explicity shared' setting for the open graph action in the Facebook Developer App Dashboard, but this worked well for me.
    – JanB
    Jul 20, 2013 at 8:48
  • The OP's examples aren't explicitly shared though, they appear to be automatic or semiautomatic posts upon playing a game or level, so likely wouldn't be approved for that capability
    – Igy
    Jul 20, 2013 at 16:14
0

I don't believe there is another method that involves what you wish to do as Facebook would restrict the potential spam this could create.

Instead, Facebook has included the publish_stream extended permission for developers interested in posting to user's timelines immediately. This may be something you're interested in.

Assuming you're using PHP, this may be a great starting point for you to look at (with the PHP SDK):

Reference: developers.facebook.com/docs/reference/php/facebook-api/

Enjoy and good luck!

3
  • thanks for the reply. I'm using the ios SDK not php. Also, I'm using the permission publish_actions, I'll have a look at publish_stream and see what the differences are.
    – Jimmy
    Jul 9, 2012 at 15:02
  • I swapped publish_action to publish_stream, and whilst the action still gets logged to the activity log, there is no other change in behaviour that I can see. The action still does not show in timeline without the user manually showing it
    – Jimmy
    Jul 9, 2012 at 15:09
  • Swapping the permission simply allows your app to publish information to the user's wall. You'll need to allow both permissions and use the reference (see me/feed) I mentioned above to actually post information to their wall.
    – Daniel Li
    Jul 9, 2012 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.