Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`#import "FBConnect.h"` vs. '#import "FBConnect/FBConnect.h" '

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?

like image 441
lionfly Avatar asked Nov 05 '22 08:11

lionfly


1 Answers

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.

like image 78
Nik Reiman Avatar answered Nov 09 '22 11:11

Nik Reiman