views:

86

answers:

1

It took me some time to get XCode to locate the Facebook sdk.

I added ‘....../facebook-ios-sdk/src ‘ into ‘Header Search Paths’ in ‘Project Settings’ (the ‘Header Search Paths’ in the ‘Target Info’ does not show the directory however) , and use:

#import "FBConnect.h" ,

instead of #import "FBConnect/FBConnect.h", then the XCode can locate the facebook sdk.

As the 'FBConnect.h' is directly under the /src, where is the 'FBConnect'? What does "FBConnect/FBConnect.h" mean? Do you guys use #import "FBConnect/FBConnect.h" without manually adding a 'FBConnect' directory or Group in XCode?

+1  A: 

I also use #import "FBConnect/FBConnect.h" in my projects, but you don't need to add the Facebook iOS SDK to your search paths in Xcode. Xcode automatically adds paths for compilable files in your source tree to gcc's list of include paths. Groups in Xcode are only for your peace of mind and project organization -- they have absolutely no effect on your project's build settings. The use of FBConnect here refers to a subdirectory on the filesystem, not the actual group name in your project.

Keep in mind that there are actually two Facebook SDKs available for the iPhone: facebook-ios-sdk and facebook-iphone-sdk. I'm not 100% sure as to why, but I think that the facebook-iphone-sdk is being deprecated in favor of the new one. Since Facebook (for some odd reason) chose to put their header files in an additional subdirectory also named "FBConnect" underneath the main source directory in the facebook-iphone-sdk project, you need to add the additional FBConnect when importing this file. Also, you'll see a lot of examples referencing the old project code which uses this importing style as well.

Nik Reiman
Thanks. So for the facebook-ios-sdk, if you do not manually add the 'FBConnect' directory yourself, you should only use #import "FBConnect.h".
lionfly
Yes, I think so... I'm still using the older facebook-iphone-sdk, so I haven't tested it personally, but looking at the code layout in the new project, it seems to be so.
Nik Reiman