Using Facebook’s Custom story and Open Graph story with iOS

With the increasing popularity of various social networking sites the important aspect that apps need to cover is that they must have the ability to connect to the user’s profile and post a status update using the app.

Sharing to Facebook from your iOS app can include a variety of operations like posting a link, sharing an update and posting a story. Now-a-days, you can see a lot of Facebook user’s updating their status that is structured in the form of a story, these posts allows you to tag your friends and check-in into places. This kind of post can be structured from your app as well. A story is more appealing in a way that, it is structured well than just posting a plain sentence status updates.

A Facebook story contains two major aspects

  • A noun (Object)
  • A verb (Action)
Configuring a story involves the integration of the noun and the verb meaningfully.

Facebook has provided some default objects and actions called common action, these actions are used in common stories. Common stories are nothing but actions that are applicable to a large chunk of population, they may be as simple as cooking a recipe or going for a walk.  You can find the list of common objects and actions at

If your story tells something other than the common stories, you need to customize using the custom stories. By using Custom stories the user is given more flexibility to create his story according to his needs. You can add your own action that may be specific to your app. As Facebook has recently launched the second version of the graph API there is not much online resource that can be found.

Open graph story Using the Facebook common objects and actions:

     Ask for publish_actions permission to post anything to Facebook on behalf of the user.
This is demonstrated in the Facebook login given in the link below.

  Creating an object: Create a mutable dictionary of FBGraphObjectForPost (because we post the object) and set the object properties by specifying the property as a key for the graph object. The og:title and og:type properties are the only 2 required fields for creating an object.

NSMutableDictionary<FBGraphObject> *object = [FBGraphObject openGraphObjectForPost];
object[@"og:title"] = @”Run”;
object[@"og:type"] = @"fitness.course";

   Create an action:  Create a mutable dictionary of FBGraphObject and set the object properties by specifying the property as a key for the graph object.

NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];

    Linking the action to the object: This is as simple as setting the <object> property of the action to the FBGraphObjectForPost that you have previously created.

action[@”object”] = object;

Posting the story: Call Open graph API to post the story!!

[FBRequestConnection startForPostWithGraphPath:@"me/fitness.runs"
 graphObject:action completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
            //handle the result and error here

Custom story:

     Ask for publish_actions permission to post anything to Facebook on behalf of the user.
This is demonstrated in the Facebook login given in the link below.

   Go to the open graph page in your Facebook app and click on create a custom story. Add the story title and the actions and objects relation to your story.

     Follow steps 2 and 3 from the open graph.

     An important difference in posting a custom story is in the specification of the path in the API call to post the story. In posting open graph story, the path will be the me/<object type>.<action type> but in custom story, it is me/<fb app namespace>:<action type>.

[FBRequestConnection startForPostWithGraphPath:@"me/x_fitnessapp:run"
 graphObject:action completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
            //handle the result and error here

The Facebook open graph post looks like the image shown below.

You can even link an existing object with a custom action. For example, in my application, the requirement was that an athlete will be able to run, swim and bike a course object. Facebook has provided common actions of only run and bike but not swim. So, I created a custom action of swim for the same course object associated with run and bike actions.

While creating a custom action, its not enough if you just create the action alone. You also need to create the respective custom story too. If that is not done, posting custom action throws an error.

We sincerely hope that the above tutorial was helpful. If you would like any clarification on the above post, write to us at


  1. Great post to simplify the configuration of open graph in FB for iOS rather than researching.. Thanks for the post.

  2. I have read your blog its very attractive and impressive. I like it your blog.

    Social Media Marketing Agency Social Media Marketing Services

  3. The most well-known business utilizes were considered before the improvement of custom applications.check it out

  4. The technology is here but customers may object to collection of so much data. In any event, these solutions will likely herald a coming economic boom in North America.lie detetors

  5. Softhax
    Find best android iOS apps free now. Install them on your phone with easily simple steps. Free android games, free

    Download latest cracks of mac & pc softwares. You can get full versions of latest games, softwares, applications and many tools.

  7. Wow! Such an amazing and helpful post this is. I really really love it. It’s so good and so awesome.
    Go Here

  8. Very nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks! instastalker


  9. نجار ابواب بالرياض نجار ابواب بالرياض
    تركيب ستائر بالرياض افضل شركة تركيب ستائر بالرياض
    تنظيف مكيفات بالرياض شركة غسيل مكيفات بالرياض
    شركة تنظيف افران الغاز بالرياض تنظيف افران بالرياض

  10. This comment has been removed by the author.

  11. Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more.
    PMP Certification

    PMP Certification in Malaysia


  12. Way cool! Some very valid points! I appreciate you penning
    this write-up and the rest of the site is also really good.


  13. 토토사이트

    It is in point of fact a nice and helpful piece of info.
    I’m happy that you simply shared this helpful information with us.

    Please stay us up to date like this. Thank you for sharing.


Post a Comment


Mobile App Testing: Strategies and Best Practices

Google I/O 2014

What Drives Your Quest for a Business Mobile App ?