使用Firebase时无法在iOS上运行Flutter应用程序.安卓系统似乎正在运行,但iOS系统出现了多个错误



所以我按照说明将Firebase添加到Flutter中,尽管在Android上可以工作,但我无法在ios模拟器上构建。我收到一些xcode错误。我已经尝试删除ios/Pods目录和Podfile.lock文件,然后使用flutter clean命令。但我还是会犯这些错误。我试过做研究,但没有发现任何帮助。以下是我在iOS模拟器上测试时遇到的错误。

提前感谢您的帮助。

颤振运行错误:

Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                           130.2s
Failed to build iOS app
Error output from Xcode build:
↳
2021-03-26 18:45:52.768 xcodebuild[15465:79135]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-17705/DTDeviceKitBase/DTDKRemoteDeviceData.m:371
Details:  (null) deviceType from 00008101-001945163408001E was NULL when -platform called.
Object:   <DTDKMobileDeviceToken: 0x7f963f7d3f80>
Method:   -platform
Thread:   <NSThread: 0x7f963b713cc0>{number = 3, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2021-03-26 18:45:52.947 xcodebuild[15465:79134]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-17705/DTDeviceKitBase/DTDKRemoteDeviceData.m:371
Details:  (null) deviceType from 00008101-001945163408001E was NULL when -platform called.
Object:   <DTDKMobileDeviceToken: 0x7f963f7d3f80>
Method:   -platform
Thread:   <NSThread: 0x7f963f725360>{number = 7, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **

Xcode's output:
↳
While building module 'firebase_core' imported from /Users/dev/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-1.0.1/ios/Classes/FLTFirebaseAuthPlugin.m:5:
In file included from <module-includes>:1:
In file included from /Users/dev/AndroidStudioProjects/aul/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
In file included from /Users/dev/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.0.2/ios/Classes/FLTFirebaseCorePlugin.h:11:
/Users/dev/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.0.2/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/dev/AndroidStudioProjects/aul/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/dev/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-1.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
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.

Xcode错误:

/Users/dev/AndroidStudioProjects/aul/build/ios/Debug-iphonesimulator/firebase_core/firebase_core.framework/Headers/FLTFirebasePlugin.h:9:9: Include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/dev/AndroidStudioProjects/aul/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h'
/Users/dev/AndroidStudioProjects/aul/build/ios/Debug-iphonesimulator/firebase_auth/firebase_auth.framework/Headers/FLTFirebaseAuthPlugin.h:12:9: Could not build module 'firebase_core'
/Users/dev/AndroidStudioProjects/aul/ios/Runner/GeneratedPluginRegistrant.m:8:9: Could not build module 'firebase_auth'

在我的iOS/Runner/AppDelegate.swift文件中,我在那里启动了Firebase,这是不需要的。我还将firebasepod插件添加到了我的Podfile中。一旦我把这些东西拿走,它就开始工作了。

最新更新