使用 Xcode 项目的实际示例Real-World Example using an Xcode Project

此示例使用Facebook 中的 POP 库This example uses the POP library from Facebook.

版本3.0 中的新增项,目标 Sharpie 支持 Xcode 项目作为输入。New in version 3.0, Objective Sharpie supports Xcode projects as input. 这些项目指定编译本机库所需的正确的标头文件和编译器标志,因此也需要对其进行绑定。These projects specify the correct header files and compiler flags necessary to compile the native library, and thus necessary to bind it too. 否则,目标 Sharpie 将选择项目的第一个_目标_及其默认配置(如果不指示这样做)。Objective Sharpie will select the first target and its default configuration of a project if not instructed to do otherwise.

在客观 Sharpie 尝试分析项目文件和头文件之前,它必须生成它。Before Objective Sharpie attempts to parse the project and header files, it must build it. 项目通常具有生成阶段,这些阶段会正确地构造用于外部使用和集成的标头文件,因此最好在尝试绑定之前始终生成完整的项目。Projects often have build phases that will correctly structure header files for external consumption and integration, so it is best to always build the full project before attempting to bind it.

$ git clone https://github.com/facebook/pop.git
Cloning into 'pop'...
   (more git clone output)

$ cd pop
$ sharpie bind pop.xcodeproj -sdk iphoneos9.0