Note: Facebook now has an official iOS SDK that purportedly supports the full graph API, and OAuth, basically filling in the hole that Bamboo was previously bridging over. I have not used it, and thus can not fully confirm, but if the new Facebook SDK meets all user needs, I will discontinue Bamboo development and support. If you have used the new Facebook SDK and have any thoughts to share with me, I would really appreciate hering from you!
You can find it here: https://github.com/facebook/facebook-ios-sdk
https://github.com/facebook/facebook-ios-sdk
most succinctly: Bamboo aims to meet all your Facebook needs as an iPhone application developer.
Bamboo (http://github.com/ryanscott/bamboo) is a new Facebook Graph library for use in iPhone development. Bamboo is a simple, lightweight, robust alternative to using the old Facebook Connect API, and a time-saving alternative to directly writing your own network code. The library is designed very similarly to Koala (http://github.com/arsduo/koala), a Ruby port of the Python library that Facebook published. Bamboo is more or less an objective-c port of the ruby port. The basic API structure is the same, and for the most part the design goals are the same.
This is as easy as it gets at integrating Facebook into an iPhone application. Using Bamboo will save you hours, probably days, of development time.
To understand the GraphAPI concepts from the perspective of a third-party library, read the Koala documentation and walkthrough.
http://wiki.github.com/arsduo/koala/
Alex also wrote a fabulous, very in-depth tutorial on how to use Koala, and everything he says applies to Bamboo, even the method names are the same, for your convenience.
http://blog.twoalex.com/2010/05/03/introducing-koala-a-new-gem-for-facebooks-new-graph-api/
Sample usage:
[[FacebookProxy instance] loginAndAuthorizeWithTarget:self callback:@selector(finishedAuthorizing)];
GraphAPI* graph = [[FacebookProxy instance] newGraph];
GraphObject* me = [graph getObject:@"me"];
NSString* myName = me.name;
UIImage* myProfileImage = [me largePicture];
NSArray* thingsILike = [graph getConnections:@"likes" forObject:me.objectID];
// update status message to my feed/wall
NSDictionary* args = [NSDictionary dictionaryWithObjectsAndKeys:@"Hello World, from bamboo!", @"message", nil];
[self._graph putToObject:me.objectID connectionType:@"feed" args:args];
// add a like connection from me to you
[self._graph likeObject:@"<you>"]
git clone http://github.com/ryanscott/bamboo.git
git clone http://github.com/facebook/facebook-iphone-sdk.git
NSString* const kFBAPIKey = @"";
NSString* const kFBAppSecret = @"";
NSString* const kFBClientID = @"";
NSString* const kFBRedirectURI = @"";
If you need help on any of those, get help at http://developers.facebook.com/docs/api#authorization or http://oauth.twoalex.com/
// klass.m
[[FacebookProxy instance] loginAndAuthorizeWithTarget:self callback:@selector(finishedAuthorizing)];
-(void)finishedAuthorizing
{
self._graph = [[FacebookProxy instance] newGraph];
}
// klass.h
GraphAPI* _graph;
@property (nonatomic, retain) GraphAPI* _graph;
See GraphAPI.h for interface. See /samples/testgraph/PadRootController.m for some example usage.
More documentation and more extensive sample app forthcoming.
Check the /samples/ directory, which includes code for an app named testgraph. I use this app as an area to develop and test new functionality.
The main integration point is FacebookProxy, which handles all of the messiness of authorization. The following 4 variables need to be defined in your app. See Constants.m in testgraph for example values.
// Facebook API
// all of these values need to be set in the client application
extern NSString* const kFBAPIKey;
extern NSString* const kFBAppSecret;
extern NSString* const kFBClientID;
extern NSString* const kFBRedirectURI;
Generally speaking, your app needs to get an access_token to use graph.facebook.api. Once you have a token, you can pretty much keep using it ad infinitum as far as I can tell. The FacebookProxy class handles all the login & token grabbing piping, right now using a oAuth sandbox setup by Alex for Koala. That will need to be handled by the lib client on an app by app basis.
Dependencies
-----
Bamboo relies on the official Facebook Connect iPhone SDK for login. Additionally, I use json-framework for parsing the responses from Facebook, but rather than have an external link to the repo I have included the files directly in the bamboo project, so you don't have to do anything. Both of these are not 100% necessary in theory, so if you want a version of bamboo with no dependencies whatsoever it can easily be done...it just won't be as usable.
http://github.com/facebook/facebook-iphone-sdk