i would like to know if it’s possible to use the facebook SDK (write on objective C) with the OF iphone SDK.
Because the facebook SDK is writen on Objective C, I think I need to create my own facebook class with OF based on the facebook SDK.
What s the method to do this?? How to use objective C class with C++ like OF do??
Sorry if it s not very clear, :mrgreen:
I explain my problem differently:
I want to use function writted in Objective C in my Application made with OF
To do it, I want to create C++ functions that call Objective C functions(I think this is what OF do).
How I can do that???
you just need to rename your .cpp file to .mm and you should be good to go. After that include whatever the objective-c header files that you need into your .mm file.
make sure that any file which also includes this .mm also changes from a .cpp file to a .mm file (actually I am not 100% sure about this, but give it a try if you run into errors).
http://wiki.openframeworks.cc/index.php-…–object.3F has more.
I try to create a file.m whose contain the objective C code.
But there is somesthing wrong with the #import function:
“No such file or directory”
When I do it with a cocoa project this is working…
Here are the steps:
" - Download Facebook Connect for iPhone code, then unzip the archive.
1 Open the src/FBConnect.xcodeproj project file.
2 Drag the FBConnect group into your application’s Xcode project.
3 Make sure that the FBConnect headers are in the include path. Go into your project’s settings and enter the relative or absolute path to the src directory.
4 Include the FBConnect headers in your code:
Is there any different between Cacoa link and C++ link??
if you’re in a .m file then you’re actually in a obj-c file.
you actually want to be in a .mm file, which is objective-c/c++.
as for the specific instructions for including facebook i’m not sure, nothing should be different. Did you put the paths into your project settings as per step 3?
if you’re #importing something with a “/” in it, then be sure that it’s included in a folder group that’s blue and not yellow. this is done by when you drag the folder in selecting “create folder references for any added folders” instead of creating groups, which is usually the default check box
Thank zach_gage for the help,
My folder was yellow, i tried with a blue one and check the path(at “header search path”), but the error is still there:
error: FBConnect/FBConnect.h: No such file or directory
I don’t enderstand why it is working on an empty cocoa project and not on my OF project!!
Hey, this is a problem I encounter a lot with external libraries and I haven’t found a very elegant solution, if anyone else has one please let me know.
What I do is:
- drag the folder in as a yellow folder again
- goto your target info (apple+alt+e)
- select the build tab
- make sure “All configurations” is selected for the Configuration (not Active, or Debug, or Release)
- scroll down to find “Header Search Paths” (or just type in “header search” in the search bar)
- there you will see “…/…/…/libs/poco/include”. add the path to the FBConnect folder (relative or absolute, up to you, depends if you want to keep the FBCOnnect folder in with your project, or in a fixed position on your disk)
hope that helps!
Thanks memo, it works !!!
It was coming from the “Header Search Paths”, I did it in “Edit project setting”(like facebook said) but not in “Taget info”
I’m trying to integrate Facebook Connect to an OF app and as I’m not familiar with obj-c I don’t really understand how this is working.
I tried to make an interface, I tried to put everything in an mm file, I tried many different things and each time it failed to compile.
Does anyone have a little source example of fbconnect on iPhone using OF ? Because I have been trying for 3 days now and I’m really lost.
hey, here is a simple demo of facebook connect working in OF.
the process i went through to get it working was to first get the official facebook example working,
i copied the FBConnect files into the src folder of a new OF project.
in xcode, i added “src/FBConnect/” to ‘header search paths’ in both project info and target info.
it was then compiling ok.
next i made a wrapper named ofxFBConnect that manages the ViewController from the original example.
im still new to obj-c (although warming to it) and was playing around with UI transition, so excuse some of the extra code in there.
This is great Lukasz, works perfect. Cheers.
ha!..think I jumped the gun there =]
Compiles great for simulator but when it comes to deploying to device I get a bunch of errors related to poco + EAGLView. see screen http://grab.by/5VpV
Seems like it was oF0061. Works fine with the latest github ver.
i’m currently searching for a way to use the FB Graph API in oF007. is it possible to use the above ofxFBConnect example within a normal non-iphone of application?