5

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?

4

1 回答 1

2

我也在#import "FBConnect/FBConnect.h"我的项目中使用,但您不需要将 Facebook iOS SDK 添加到 Xcode 中的搜索路径中。Xcode 会自动将源代码树中可编译文件的路径添加到 gcc 的包含路径列表中。Xcode 中的组只是为了您的安心和项目组织——它们对您的项目的构建设置绝对没有影响。这里的使用是FBConnect指文件系统上的子目录,而不是项目中的实际组名。

请记住,实际上有两个适用于 iPhone 的 Facebook SDK:facebook-ios-sdk 和 facebook-iphone-sdk。我不是 100% 确定为什么,但我认为 facebook-iphone-sdk 正在被弃用,取而代之的是新的。由于 Facebook(出于某种奇怪的原因)选择将他们的头文件放在 facebook-iphone-sdk 项目的主源目录下的一个名为“FBConnect”的附加子目录中,因此您需要FBConnect在导入此文件时添加附加文件。此外,您还会看到很多引用旧项目代码的示例,这些代码也使用这种导入样式。

于 2010-10-07T11:55:39.853 回答