【问题标题】:aws cognito swift header erroraws cognito swift 标头错误
【发布时间】:2016-10-20 17:20:01
【问题描述】:

我正在尝试通过使用 pod 安装 aws cognito 和 swift。但是在我安装了 pod 之后:

pod 'AWSCognito'
pod 'AWSCore'

我不断收到以下错误could not build Objective-C module 'AWSCore' on

import AWSCore
import AWSCognito

在 aws cognito pod 中,我收到以下错误 include of non-modular header inside framework module 'AWSCore' on

 #import <sqlite3.h>

我尝试将非模块头设置为 yes 并删除派生数据,但仍然无法构建?

【问题讨论】:

  • 你是如何解决这个问题的?

标签: swift amazon-web-services amazon-cognito


【解决方案1】:

您应该创建桥接头文件以在 swift 中使用 Objective c 代码。要创建桥接头文件,请单击文件 -> 新建 -> 文件 -> iOS -> 头文件。然后将您的桥接头文件命名为以下模式“YourProjectName-Bridging-Header.h”。然后在头文件中添加以下内容以访问目标 c 框架。

#import <AWSCore/AWSCore.h>
#import <AWSCognito/AWSCognito.h>

然后在构建设置中配置您的“YourProjectName-Bridging-Header.h”,

选择您的项目目标 -> 构建设置 -> Swift 编译器 - 常规 -> Objective c 桥接头 -> 添加具有完整路径的桥接头文件。(或者只需单击 option-key + 拖动)

【讨论】:

    猜你喜欢
    • 2017-10-15
    • 2019-04-21
    • 2018-02-13
    • 2017-02-09
    • 2020-08-06
    • 2019-04-11
    • 1970-01-01
    • 2021-09-28
    • 2018-11-11
    相关资源
    最近更新 更多