error: include of non-modular header inside framework module

最近在做一个新的基于 Flutter 应用,创建应用的命令是:

flutter create -i swift -a kotlin app

依赖了自己开发的 wechat 插件,之后执行 flutter run 的时候,就一直报下面这个错误了:

code's output:
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    While building module 'wechat' imported from /Users/pantao/workspace/gitee/onmr/chain-app/ios/Runner/GeneratedPluginRegistrant.m:6:
    In file included from <module-includes>:1:
    In file included from /Users/pantao/workspace/gitee/onmr/chain-app/build/ios/Debug-iphonesimulator/wechat/wechat.framework/Headers/wechat-umbrella.h:13:
    /Users/pantao/workspace/gitee/onmr/chain-app/build/ios/Debug-iphonesimulator/wechat/wechat.framework/Headers/WechatPlugin.h:2:10: error: include of non-modular header inside framework module 'wechat.WechatPlugin':
    '/Users/pantao/workspace/gitee/onmr/chain-app/ios/Pods/Headers/Public/WechatOpenSDK/WXApi.h' [-Werror,-Wnon-modular-include-in-framework-module]
    #include "WXApi.h"
             ^
    1 error generated.
    /Users/pantao/workspace/gitee/onmr/chain-app/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: could not build module 'wechat'
    #import <wechat/WechatPlugin.h>
            ^
    2 errors generated.

最简单的解决办法:

TARGETS -> Build Settings -> 搜索 Allow Non -> 将 Allow Non-modular includes in Framework Modules 设置为 YES

WX20181224-200614@2x.png

标签: ios, Swift

评论已关闭