我在 CommonCrypto 上写了一个私有(private) pod它明确依赖于 CommonCrypto。 header 具有由 CommonCrypto 声明的类型,例如:
#include <CommonCrypto/CommonDigest.h>
typedef CC_SHA256_CTX qwer_digest_evp;
由于 CC_SHA256_CTX
是在 CommonCrypto 中声明的,我不能简单地将 header 导入移动到实现文件中。
我使用 cocoapods 将这个 pod 集成到我的项目中,并尝试了下面的安装后 Hook ,但它没有用(选自 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 魔法)。这可以按照对 Importing CommonCrypto in a Swift framework 的回答中的步骤来完成。 .该解决方案与您的 Xcode 项目中的 Objective-C 或 C 一样运行良好。
引用答案:
I've added some CocoaPods magic to jjrscott's answer in case you need to use CommonCrypto in your CocoaPods library.
关于objective-c - 获取错误 "Include of non-modular header inside framework module",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51080249/