,ios,swift,flutter,android-studio,dart"/>

首页 > 解决方案 > 我的代码错误#import

问题描述

我的问题是:我正在使用来自 pub.dev 的 [share package][1],当我尝试构建我的应用程序时,出现以下错误:

    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from /Users//Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.m:5:
    /Users//Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from /Users/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.m:7:
    /Users/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~ ```

标签: iosswiftflutterandroid-studiodart

解决方案


修复错误:找不到“Flutter/Flutter.h”文件 #import <Flutter/Flutter.h> 您需要删除或不使用

firebase_admob

利用

native_admob_flutter

或者

admob_flutter

当你使用 firebase 并且你在 podfile 中使用这样的代码时,你会得到这个错误

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

推荐阅读