/Scrumptious-iOS

Facebook Open Graph Sample App using Kinvey as a backend

Primary LanguageObjective-CApache License 2.0Apache-2.0

Scrumptious (Kinvey)

This sample code shows how to modify Facebook's Scrumptious Sample App to use Kinvey to host Open Graph Objects and post actions to a user's timeline. Kinvey dynamically generates the Open Graph object html based upon the information chosen by the user. This means it's easily extended and changeable.

Scrumptious users post that they "ate" a meal, allowing them to tag where, when, and with who they ate the meal, including the ability to take a picture of the meal.

Using the Sample

The sample repository comes with the KinveyKit and Fracebook frameworks that it was developed against. In production code, you should update to the latest versions of these libraries.

Set-up the Backend

  1. Create your Scrumptious App on Facebook.
    • Set up the "eat" action and "meal" object.
  2. Create a new App on Kinvey.
    1. Create a "meals" collection. This is store the data for each meal uploaded by the users.
    2. Create a "External Data" -> "Facebook" collection. Follow the steps in this tutorial set up the mappings between the Kinvey object and the Facebook object.

Modifications to the Original Scrumptious

  1. Created MealModel object to represent the OG meal object. This is used to store the meal's information in the Kinvey backend.
  2. MealModel objects are populated with data chosen by the user in the interface, and then uploaded to Kinvey in three separate steps:
    1. Upload the image to Kinvey.
    2. Upload the data to Kinvey.
    3. Tell Kinvey to post the eat action to the user's timeline.
  3. Added ability to take a picture of the meal.
  4. Added additional OG fields, such as determiner, to improve the user experience.
  5. Updated code to latest Objective-C syntax (Xcode 4.6).

Extending Scrumptious

  • To add new meal types, just add the name to the self.mealTypes array created in SCViewController.m's viewDidLoad method. You will also need to determiner to the self.determiners array at the same index. The determiner is the English indefinite article that corresponds to the meal name. This is used to make the OG action read like a normal sentence. For example "Bob ate a Hotdog", "Jill ate an Escargot", "Roger ate Mexican".
  • To add new fields, add a property to MealModel.h and map that property to a backend field name in MealModel.m's hostToKinveyPropertyMapping method. Then in the FBOG collection on the backend, map the field name to the Facebook Open Graph object field name.

Contact

Website: www.kinvey.com

Support: support@kinvey.com