OC&Swift混编编译问题Allow Non-modular Includes in Framework Modules

Allow Non-modular Includes in Framework Modules 不同场景下解决这个问题的方案也不同,这里提供一种在OC&Swift混编时可能出现的问题。
问题背景:
1)OC&Swift混编
2)Swift组件依赖OC组件
3)使用箭头头文件引入方式
4)Swift组件引用OC组件内的头文件,同时OC组件内又使用箭头引入的方式,引用了其他组件的头文件

以上就是我们OC开发为主的项目里接入Swift版本的SDK时遇到的情况,解决方案如下。
参考stackoverflow:

Allow Non-modular Includes in Framework Modules only work in objc code. not work in swift.
After a period of research, I found that swift can pass warning parameter to clang, so set OTHER_SWIFT_FLAGS to -Xcc -Wno-error=non-modular-include-in-framework-module inhibit swift import error.
just for someone who have same problem

具体的解决方式:

s.pod_target_xcconfig = { 
    'OTHER_SWIFT_FLAGS' => '-Xcc -Wno-error=non-modular-include-in-framework-module'
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容