获取错误"Include of non-modular header inside framework module"



我有一个写在CommonCrypto之上的私有pod,它明确依赖于CommonCrypto。标头具有由 CommonCrypto 声明的类型,例如:

#include <CommonCrypto/CommonDigest.h>
typedef CC_SHA256_CTX qwer_digest_evp;

由于CC_SHA256_CTX是在 CommonCrypto 中声明的,因此我不能简单地将标头导入移动到实现文件中。

我使用 cocoapods 将此 pod 集成到我的项目中,并尝试了下面的安装后钩子,但它不起作用(从 SO 中挑选(。

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
target.build_settings(config.name)['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
end
end
end

一个有效的选择可能是构建CommonCrypto的模块版本(也许添加了CocoaPods魔法(。这可以通过按照在 Swift 框架中导入 CommonCrypto 的答案中的步骤来完成。该解决方案在Xcode项目中与Objective-C或C一样有效。

引用答案:

我在jjrscott的答案中添加了一些CocoaPods魔法,以防您需要在CocoaPods库中使用CommonCrypto。

最新更新