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.
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.
- Create your Scrumptious App on Facebook.
- Set up the "eat" action and "meal" object.
- Create a new App on Kinvey.
- Create a "meals" collection. This is store the data for each meal uploaded by the users.
- Create a "External Data" -> "Facebook" collection. Follow the steps in this tutorial set up the mappings between the Kinvey object and the Facebook object.
- Created MealModel object to represent the OG meal object. This is used to store the meal's information in the Kinvey backend.
- MealModel objects are populated with data chosen by the user in the interface, and then uploaded to Kinvey in three separate steps:
- Upload the image to Kinvey.
- Upload the data to Kinvey.
- Tell Kinvey to post the
eat
action to the user's timeline.
- Added ability to take a picture of the meal.
- Added additional OG fields, such as
determiner
, to improve the user experience. - Updated code to latest Objective-C syntax (Xcode 4.6).
- To add new meal types, just add the name to the
self.mealTypes
array created inSCViewController.m
'sviewDidLoad
method. You will also need to determiner to theself.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 inMealModel.m
'shostToKinveyPropertyMapping
method. Then in theFBOG
collection on the backend, map the field name to the Facebook Open Graph object field name.
Website: www.kinvey.com
Support: support@kinvey.com