1
\$\begingroup\$

im trying to implement a method in my native iOS game the publish a story on face book such as this photo Facebook Activitys

most games that is integrated with facebook share stories like this in the activity section on the timeline

any good example especially for iOS 6

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

What you are looking for is called "actions". Here is how to post an action.

// create an Open Graph action
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:objectId forKey:@"dish"];

// create action referencing user owned object
[FBRequestConnection startForPostWithGraphPath:@"/me/fbogsample:eat" graphObject:action completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
  if(!error) {
    NSLog([NSString stringWithFormat:@"OG story posted, story id: %@", [result objectForKey:@"id"]]);
    [[[UIAlertView alloc] initWithTitle:@"OG story posted"
                                message:@"Check your Facebook profile or activity log to see the story."
                               delegate:self
                      cancelButtonTitle:@"OK!"
                      otherButtonTitles:nil] show];
  } else {
    // An error occurred
    NSLog(@"Encountered an error posting to Open Graph: %@", error);
  }
}];

However, before you post a question about Facebook open-graph in general, you should check here first.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .