I’ve created an addon to make posting to Facebook from ios more easy.

It automatically checks if there is an internet connection before launching

You need to create your own app id in Facebook (very easy to do) I’ve included links etc in pdf

Add 4 Frameworks:

Accounts.framework ,
libsqilite3.dylib ,
FacebookSDK.framework *(drag it)

make sure

your app can run in the background

modify your plist to add your fb app id


I’ve included a pdf with detailed tutorial on how to set it up.


About the Addon:

you can post images by providing path:

or directly pass an ofImage to it

and of-course post Text:

FaceBook->postText(“Testing ofxfacebook addon with OF”);

Here is some sample code:

void testApp::setup()  
    ofxiPhoneAlerts.addListener(this);///don't forget this  
    FaceBook = new ofxFb();  
void testApp::launchedWithURL(string url){  
    FaceBook->getAnswer(url); ////very important  
    delete FaceBook;  

The addon is still on BETA mode **

I’ve not tested it on many devices

Developed on x-code 4.2 OF 007 and SDK 5.0


New Update!

In this Version you can Post Both Image and Text in the Same post

Simple like:

    FaceBook->postImg_with_text ("Default.png","testing ofxFB");  

also if you want to check if the device has Internet connection use the isConnected() bool

the addon checks automatically before posting but if you want to check for other reasons the bool is there for general use

… This is probably the final version, so I am going to post it over at my GitHub

… it became apparent to me that I should rewrite the addon using c++ Templates to allow a more dynamic and easy to use addon…

I replaced the long long confusing code inside the addon with a more simple abstract object…

…instead of having a lot of overwritten/loaded functions like Post_img() Post_text() etc

I replaced ALL with one abstract function post(WHATEVER);
What this means is that you can now do:

post image form URL so you don’t have to increase the size of your app
add text to that and also add URL (of your app in the app store for example)

Facebook.post("bla bla bla ","http.myappurl.com","http.urlImage.png");  

paste image from iphone:

ofImage im;  
Facebook.post("bla bla bla ",im);  


ofImage * im;  
Facebook.post("bla bla bla ",im);  


ofImage im;  





The idea is that you can post whatever you like just separate it with a coma:

Limit is 3 parameters and you can’t post two images. only one Image +text OR urlImage+text
or text+URL or just URL or** text+URL+urlImage**

Also I added the ability to personalize the text that the user will see:
you can set title and body of notification:


And… If the user posts something on FB

you can get that too:

Just set the ID of the post before posting:


and then have this to see if user gets positive answer.

Do stuff  
Ive included a simple example and a more advanced example  

This looks easy to use. Nice work.

I haven’t done any facebook integration lately, but I have been working with Twitter using the Social.framework so that users don’t have to sign in. Integration with the native social.framework might be useful.


This is awesome ! I have one question though, I know this is intended for iOS , but would it work on OS X in 10.8 ? I’m going about this by using HTTP post and a PHP script, but something native would be super.

I am trying to run the example attached to the addon and I cant seem to get it working.
I’ve tried both the simple and the advanced and as a I run the app, the only thing I see is the loading animation from the OS.
When I press the home button and I open the app again I can actually see a frame of the Facebook login request page there, but it seems like the application is drawing on top of it.
Is ofxFacebook supposed to work with the integrated Facebook service in iOS? I’m also logged in there, just in case.
Just to clarify, this is all running in the iPhone emulator with iOS 6.1

BTW, this addon looks great!! Great job!

hey thanks for the feedback.

the examples were created in OF 007 so you must rebuild them , I will update them soon enough though.

I spotted that bug as well when I tested it on a device that used the Facebook app…

I don’t use Facebook app on my phone so when I tested it on a “virgin” phone it worked fine…

most likely I will need to add an extra line somewhere in there…

let me know if you have more info

I rebuilt the examples for 0.7.4 and added an install.xml… (github)

I am trying to recreate that bug I found yesterday on a friend’s ipad. *(6.1.3)

-I restored my ipod on 6.1.3,

-downloaded the latest Facebook app from within Settings/Facebook/install

-logged on with that
-enabled PushNotifications

-run the example

… but no luck,

Can you be more specific on the other FB stuff/apps/features you have going on in the background

one of them might be interfeering with the SDK I think I red it somewhere that something like that creates problems… but If I can’t recreate the error on my own device I can’t fix it…

Hi there!
I’ve updated my project with the new addon and the new examples and they work great!
Thanks for the effort!

Are you having trouble running them on an iPad now?

Should we start looking anyway in which we can integrate the login inside the app? Maybe just a custom webview inside the app could work.
What I actually want to do is to be able to log out the user after the post has been made… any ideas?

no it works on the ipad.

I just thought I spotted a weird bug yesterday but I wasn’t able to recreate it… so… maybe it was just a one time thing. :confused:

by the way anybody knows if
there is a way to add frameworks to xcode directly from the Project Generator and the xml install file like we add the addons?

I created a phonegap plugin awhile back for the social framework… So I just translated it for openframeworks. It’s at https://github.com/claytical/ofxiPhoneSocial


does this work on pc or only on Iphone?