我在 IOS 上的 flutter 中使用 firebase_admob 时遇到了这个错误我已经运行 flutter clean 但仍然面临这个错误

问题描述

错误代码输出::::

Xcode 构建完成。 301.9s

无法构建 iOS 应用

Xcode 构建的错误输出: ↳ ** 构建失败 **

Xcode 的输出: ↳

In file included from /Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:5:
In file included from /Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.h:6:
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTFirebaseAdMobPlugin.h:28:4: error: expected a type
- (GADUnifiednativeAdView *)createNativeAd:(GADUnifiednativeAd *)nativeAd
   ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTFirebaseAdMobPlugin.h:28:45: error: expected a type
- (GADUnifiednativeAdView *)createNativeAd:(GADUnifiednativeAd *)nativeAd
                                            ^
In file included from /Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:5:
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.h:39:45: error: no type or protocol named 'GADInterstitialDelegate'
@interface FLTInterstitialAd : FLTMobileAd <GADInterstitialDelegate>
                                            ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.h:44:28: error: no type or protocol named 'GADUnifiednativeAdLoaderDelegate'
    : FLTMobileAdWithView <GADUnifiednativeAdLoaderDelegate,GADUnifiednativeAdDelegate>
                           ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:39:17: error: no kNown class method for selector 'configureWithApplicationID:'
  [GADMobileAds configureWithApplicationID:appId];
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:97:79: warning: implicit conversion loses integer precision: 'FLTMobileAdStatus' to 'int' [-Wshorten-64-to-32]
  Nsstring *statusstring = (Nsstring *)statusToString[[NSNumber numberWithInt:_status]];
                                                      ~                       ^~~~~~~
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:211:69: error: expected a type
- (void)adView:(GADBannerView *)adView didFailToReceiveAdWithError:(GADRequestError *)error {
                                                                    ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:242:3: error: unkNown type name 'GADInterstitial'; did you mean 'GADInterstitialAd'?
  GADInterstitial *_interstitial;
  ^~~~~~~~~~~~~~~
  GADInterstitialAd
In module 'GoogleMobileAds' imported from /Users/bism/AndroidStudioProjects/Flutter_app/ios/Pods/Headers/Private/Firebase/Firebase.h:125:
/Users/bism/AndroidStudioProjects/Flutter_app/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/GoogleMobileAds/GoogleMobileAds.framework/Headers/GADInterstitialAd.h:28:12: note: 'GADInterstitialAd' declared here
@interface GADInterstitialAd : NSObject <GADFullScreenPresentingAd>
           ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:271:35: error: expected a type
- (void)interstitialDidReceiveAd:(GADInterstitial *)ad {
                                  ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:278:23: error: expected a type
- (void)interstitial:(GADInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error {
                      ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:278:73: error: expected a type
- (void)interstitial:(GADInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error {
                                                                        ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:284:40: error: expected a type
- (void)interstitialWillPresentScreen:(GADInterstitial *)ad {
                                       ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:288:40: error: expected a type
- (void)interstitialWilldismissScreen:(GADInterstitial *)ad {
                                       ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:292:39: error: expected a type
- (void)interstitialDiddismissScreen:(GADInterstitial *)ad {
                                      ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:296:43: error: expected a type
- (void)interstitialWillLeaveApplication:(GADInterstitial *)ad {
                                          ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:255:21: error: unkNown receiver 'GADInterstitial'; did you mean 'GADInterstitialAd'?
  _interstitial = [[GADInterstitial alloc] initWithAdUnitID:adUnitId];
                    ^~~~~~~~~~~~~~~
                    GADInterstitialAd
In module 'GoogleMobileAds' imported from /Users/bism/AndroidStudioProjects/Flutter_app/ios/Pods/Headers/Private/Firebase/Firebase.h:125:
/Users/bism/AndroidStudioProjects/Flutter_app/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/GoogleMobileAds/GoogleMobileAds.framework/Headers/GADInterstitialAd.h:28:12: note: 'GADInterstitialAd' declared here
@interface GADInterstitialAd : NSObject <GADFullScreenPresentingAd>
           ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:255:44: error: no visible @interface for 'GADInterstitialAd' declares the selector 'initWithAdUnitID:'
  _interstitial = [[GADInterstitial alloc] initWithAdUnitID:adUnitId];
                   ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:256:17: error: property 'delegate' not found on object of type 'GADInterstitialAd *'
  _interstitial.delegate = self;
                ^
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:258:18: error: no visible @interface for 'GADInterstitialAd' declares the selector 'loadRequest:'
  [_interstitial loadRequest:[factory createRequest]];
   ~~~~~~~~~~~~~ ^~~~~~~~~~~
/Users/bism/development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:313:3: error: unkNown type name 'GADUnifiednativeAdView'; did you mean 'GADNativeAdView'?
  GADUnifiednativeAdView *_nativeAd;
  ^~~~~~~~~~~~~~~~~~~~~~
  GADNativeAdView

In module 'GoogleMobileAds' imported from /Users/bism/AndroidStudioProjects/Flutter_app/ios/Pods/Headers/Private/Firebase/Firebase.h:125:
/Users/bism/AndroidStudioProjects/Flutter_app/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/GoogleMobileAds/GoogleMobileAds.framework/Headers/GADNativeAd.h:114:12: note: 'GADNativeAdView' declared here
@interface GADNativeAdView : UIView
           ^
Fatal error: too many errors emitted,stopping Now [-ferror-limit=]
1 warning and 20 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

无法为模拟器构建应用程序。 在 iPhone 8 上启动应用程序时出错。

Pubspec.yaml 文件 名称Flutter_app 描述:一个新的 Flutter 应用。

publish_to: 'none' # 如果你想发布到 pub.dev 删除这一行

版本:1.0.0+1

环境: sdk:">=2.7.0

依赖: 扑: sdk:颤动

cupertino_icons:^1.0.0 firebase_core:^0.7.0 cloud_firestore:^0.16.0+1 firebase_admob:^0.11.0+1

dev_dependencies: 颤振测试: sdk:颤动

颤动:

使用材料设计:真实

Flutter Doctor 输出 [✓] Flutter (Channel stable,1.22.6,on Mac OS X 10.15.7 19H15 darwin-x64,locale en-GB) • Flutter 1.22.6 版位于 /Users/bism/development/Flutter • 框架修订 9b2d32b605(6 周前),2021-01-22 14:36:39 -0800 • 引擎修订版 2f0af37152 • Dart 版本 2.10.5

[✓] Android 工具链 - 为 Android 设备开发(Android SDK 版本 30.0.3) • Android SDK 位于 /Users/bism/Library/Android/sdk • 平台 android-30,构建工具 30.0.3 • Java 二进制文件位于:/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java 版 OpenJDK 运行时环境(构建 1.8.0_242-release-1644-b3-6915495) • 接受所有 Android 许可。

[✓] Xcode - 为 iOS 和 macOS 开发 (Xcode 12.4) • Xcode 位于 /Applications/Xcode.app/Contents/Developer • Xcode 12.4,构建版本 12D4e • CocoaPods 1.10.1 版

[!] Android Studio(4.1 版) • Android Studio 位于 /Applications/Android Studio.app/Contents ✗ 未安装 Flutter 插件;这增加Flutter 特定的功能。 ✗ 未安装 Dart 插件;这增加了 Dart 特定的功能。 • Java 版 OpenJDK 运行时环境(构建 1.8.0_242-release-1644-b3-6915495)

[✓] 已连接设备(1 个可用)
• iPhone 8(手机) • 6BAE798D-6E24-4623-AD3C-C3DFC76EC595 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4(模拟器)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)