导入 Square SDK 时克隆和复制方法不起作用

Clone and Copy Method Not Working When Importing Square SDK

我从 GitHub 下载示例项目,按照说明基本上将 SDK 复制并粘贴到我的应用程序中,但缺少框架。

此外,如果我只是将包含文件的文件夹拖放到我的应用程序中,如 GitHub 所说:

Clone-and-Copy

You can always just clone this repository and copy the source files from the SquarePointOfSaleSDK directory into your project, but when using this approach, you must manually keep the SDK up-to-date yourself.

当我构建应用程序时出现以下错误:

我曾尝试将 SquarePointOfSaleSDK.h 添加到链接的框架和库,但没有成功。

有什么想法吗?

  1. 克隆 https://github.com/square/SquarePointOfSaleSDK-iOS 存储库
  2. 将目录复制到项目的根目录中。 (见图 1)。通常,这是包含 <YourAppName>.xcodeproj 文件的同一文件夹。

  3. 在XCode的文件资源管理器中,将复制的 SquarePointOfSaleSDK 目录拖到您的应用项目中> Select“创建组” > 选中应用目标旁边的“添加到目标

  4. 在构建设置下(见图 2),将 $(SRCROOT) 添加到 User Header Search Path 构建设置 > 将其设置为递归搜索子文件夹. > 为您的目标始终搜索用户路径构建设置标志设置为是

  5. 在任何相关 header/implementation 文件中使用以下导入声明: #import <SquarePointOfSaleSDK/SquarePointOfSaleSDK.h>

图 1:添加 SquarePointOfSaleSDK 组和文件后的文件资源管理器:

图 2:构建设置