Introducing PhFacebook, a Cocoa framework to Facebook’s API
August 29th, 2010
For the upcoming version of iChibi, I needed a MacOSX interface to Facebook’s API.
There are several iOS libraries (FB Connect, ShareKit…) but I found only one that was MacOSX-specific: MBAbeFook, which implements the (deprecated) Facebook REST API.
This was a problem because:
- I need extended permissions, and it’s a song-and-dance to get those using the REST API
- The authentication UI from REST may present checkboxes to the user for extended permissions.
Users don’t check boxes. They click “I agree”… - The REST API is deprecated.
So I wrote my own. PhFacebook is an embeddable MacOSX framework to easily access Facebook’s API.
- Uses Facebook’s new ‘graph’ API internally, handles OAuth in a WebView for you and returns JSON strings.
- Comes with a sample application to show you how to use it.
- Supports extended permissions.
- Localized in English and French.
Find it on github. MIT-licensed.
Categories: Development, MacOSX
Hey!
I was super happy when I found this framework! However, when I try to use your sample code I am getting 9 errors. It is not finding your framework headers. I built the framework, then dragged from the finder into the sample project…made sure it was on the target…made a direct dependency….What am I missing? Header Search Paths?
Thanks!
Try to have a common build folder. It makes things a lot easier when dealing with subprojects and frameworks.
Xcode->Preferences->Building->Place Build Products in->Customized location
I do that because while I can fix the search paths for one project, they will be different for other projects and it tends to not work on other people’s systems. With a common build folder, everything just works.
Tried everything I can think of (and I have this working with Facebook’s own iOS framework)
But clicking Get Access Token doesn’t ever do anything
@Richard
Fixed in the github project. Thanks for letting me know; a better way is through github’s issue tracker interface.
Hi Philippe!
I like your framework but i have a little problem, the webview won’t show up with the loginpage.
I have set the delegate and everything, i see the loginURL in the debug console but no webview will appear.
Any clues? I use Xcode 4 is that does matter.
Regards , Billy
Hi Billy,
Please open an issue on github: https://github.com/philippec/PhFacebook/issues
That is a much better way to track down these problems.
Thanks!
Trying to get this working… followed all the steps to the letter, but something’s breaking when I go to run. Built the framework with no problem. Drug from the Finder into my app, copied. Added to copy phase. Added the appropriate #import statement. Built MyApp with no problem. When I go to run, it fails with:
dyld: Library not loaded: @rpath/PhFacebook.framework/Versions/A/PhFacebook
Referenced from: /Volumes/WorkingCopies/MyApp/source/trunk/build/Debug/MyApp.app/Contents/MacOS/MyApp
Reason: image not found
Deleted all, started over 3 times…. same problem. What am I missing?
@Mike
Hmmm, I recently changed to @rpath. Can you open an issue on github so we can track this?
Hello,
first of all: Thank you so much for your framework…I think it’s really great!
Since I’m totally new to the graph API and to your framework I have one question. Is it possible to Post something with your framework?
The API example to post something is
curl -F ‘access_token=…’ \
-F ‘message=Hello, Arjun. I like this new API.’ \
https://graph.facebook.com/arjun/feed
but I don’t know how to put this into [fb sendrequest: NSString]? Can someone give me a hint how the string has to look like? @”‘message=Test’ \ me/feed” does not work.
Thank you
I’m sure it’s possible, I just never tried. Did you add the “write” property to the request? Maybe that’s all you’re missing. The sample app only has “read”.
Hello
Supper, Im trying to use it but I dunno what am I doing wrong, first I got the no image found.. but then what I did it was to jsut drag and drop the whole PhFacebook proj to my project wrokspace and it seemed to compile and run..
I was trying the test app, I set up my add id and when I clicked get token I was asked to authorize the use of my app, but then I just saw a success word and that was it. I I was expecting other page as in the permissions are @read_stream”, @”export_stream”,
What did I miss?
@Gustavo
Hi Gustavo,
Please open an issue on github: https://github.com/philippec/PhFacebook/issues
That is a much better way to track down these problems.
Thanks!