Flutter:在框架模块“firebase_core.FLTFirebasePlugin”内包含非模块化标头

问题描述 投票:0回答:3

我一直在尝试在 IOS 设备上运行我的 Flutter 代码。但是,我收到一些有关框架模块内的非模块化标头的错误。

日志:

While building module 'firebase_core' imported from
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_auth-0.20.0+1/ios/Classes/FLTFirebaseAuthPlugin.m:5:
In file included from <module-includes>:1:
In file included from
/Users/admin/Desktop/Ali/GuestInMe/ios/Pods/Target Support
Files/firebase_core/firebase_core-umbrella.h:13:
In file included from
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_core-0.7.0/ios/Classes/FLTFirebaseCorePlugin.h:11:
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_core-0.7.0/ios/Classes/FLTFirebasePlugin.h:9:9: error:
include of non-modular header inside framework module
'firebase_core.FLTFirebasePlugin':
'/Users/admin/Desktop/Ali/GuestInMe/ios/Pods/Headers/Public/Firebase
Core/FirebaseCore.h'
[-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
        ^
1 error generated.
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_auth-0.20.0+1/ios/Classes/FLTFirebaseAuthPlugin.m:5:9: fatal
error: could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>
 ~~~~~~~^
2 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.

我尝试过的:

  1. 我尝试更改 Xcode 的构建设置并允许非模块化导入 -> flutter clean -> pod install in ios 文件夹 -> flutter run

  2. 尝试将文件从项目更改为公开,但它已经是公开的。

  3. 重新安装所有 pod 文件。

    'firebase_core.FLTFirebasePlugin': Screenshot

firebase flutter flutter-dependencies flutter-ios
3个回答
6
投票

最终起作用的是:

  1. 将所有
    pubspec.yaml
    依赖项放入最新版本。
  2. 删除
    pubspec.lock
    Pods
    中的
    ios
    Podfile.lock
  3. 文件夹
  4. 运行
    flutter clean
    ->
    flutter pub get
    ->
    cd ios
    ->
    pod install
    ->
    cd ..
    ->
    flutter run

你应该可以走了


6
投票

您可以通过编辑 Podfile 来修复它

post_install do |installer|
  installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
    configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
  end
end

0
投票

对我来说以下解决方案解决了问题:

目标下的

xCode
->
Build Settings
->

Allow Non-modular Includes in Framework Modules
设置为
YES

我还做了以下操作:

在项目导航器中选择

firebase_core-umbrella.h
文件。在右侧的
target membership
区域中,目标旁边会有一个下拉菜单。选择
public
(默认值为
project
private
)。

您必须对错误消息中带有

.h
的所有其他文件执行上述操作。

© www.soinside.com 2019 - 2024. All rights reserved.