在使用firebase进行iOS开发时,如何修复致命错误?
首先,我在visual studio代码中工作。但这不应该是问题所在,因为FlatterSDK附带的默认代码在iOS模拟器中运行得非常好。这是我的错误:在使用firebase进行iOS开发时,如何修复致命错误?,ios,firebase,flutter,visual-studio-code,admob,Ios,Firebase,Flutter,Visual Studio Code,Admob,首先,我在visual studio代码中工作。但这不应该是问题所在,因为FlatterSDK附带的默认代码在iOS模拟器中运行得非常好。这是我的错误: Launching lib/main.dart on iPhone 11 Pro Max in debug mode... Xcode build done. 13.1s Failed to build iOS app Error output from Xco
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Xcode build done. 13.1s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
duplicate symbol '_pb_field_iter_next' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 3.o
duplicate symbol '_pb_field_iter_begin' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 3.o
duplicate symbol '_pb_field_iter_find' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 3.o
duplicate symbol '_pb_field_iter_next' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common.o
duplicate symbol '_pb_field_iter_begin' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common.o
duplicate symbol '_pb_field_iter_find' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common.o
duplicate symbol '_pb_decode_svarint' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_decode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_decode 3.o
duplicate symbol '_pb_decode_varint' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_decode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
duplicate symbol '_pb_write' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
duplicate symbol '_pb_encode_submessage' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
duplicate symbol '_pb_encode' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
duplicate symbol '_pb_encode_tag_for_field' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
duplicate symbol '_pb_encode_delimited' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
duplicate symbol '_pb_encode_nullterminated' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
duplicate symbol '_pb_encode_fixed64' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
duplicate symbol '_pb_encode_fixed32' in:
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode 2.o
/Users/justindosaj/Library/Developer/Xcode/DerivedData/Runner-bchdppgbhrbnzxagnhfnozruredr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
ld: 68 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Exited (sigterm)
还需要注意的是,在出现此错误之前,我收到一个错误,即“未找到模块‘firebase_core’”@import firebase_core
我的医生:
[flutter] flutter doctor -v
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-US)
• Flutter version 1.12.13+hotfix.5 at /Users/justindosaj/Desktop/ApplicationSoftware/flutter
• Framework revision 27321ebbad (6 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/justindosaj/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /usr/bin/java
✗ Could not determine java version
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.8.4
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/setup/#android-setup for detailed instructions).
[✓] Connected device (1 available)
• iPhone 11 Pro Max • F64065AE-360F-474C-BC50-133614E7DC6A • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
! Doctor found issues in 2 categories.
exit code 0
我的播客文件:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Runner' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Runner
pod 'Firebase/Analytics'
end
这是我的podfile.lock
PODS:
- Firebase/Analytics (6.15.0):
- Firebase/Core
- Firebase/Core (6.15.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 6.2.1)
- Firebase/CoreOnly (6.15.0):
- FirebaseCore (= 6.6.0)
- FirebaseAnalytics (6.2.1):
- FirebaseCore (~> 6.6)
- FirebaseInstanceID (~> 4.3)
- GoogleAppMeasurement (= 6.2.1)
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
- GoogleUtilities/MethodSwizzler (~> 6.0)
- GoogleUtilities/Network (~> 6.0)
- "GoogleUtilities/NSData+zlib (~> 6.0)"
- nanopb (= 0.3.9011)
- FirebaseCore (6.6.0):
- FirebaseCoreDiagnostics (~> 1.2)
- FirebaseCoreDiagnosticsInterop (~> 1.2)
- GoogleUtilities/Environment (~> 6.5)
- GoogleUtilities/Logger (~> 6.5)
- FirebaseCoreDiagnostics (1.2.0):
- FirebaseCoreDiagnosticsInterop (~> 1.2)
- GoogleDataTransportCCTSupport (~> 1.3)
- GoogleUtilities/Environment (~> 6.5)
- GoogleUtilities/Logger (~> 6.5)
- nanopb (~> 0.3.901)
- FirebaseCoreDiagnosticsInterop (1.2.0)
- FirebaseInstallations (1.1.0):
- FirebaseCore (~> 6.6)
- GoogleUtilities/UserDefaults (~> 6.5)
- PromisesObjC (~> 1.2)
- FirebaseInstanceID (4.3.0):
- FirebaseCore (~> 6.6)
- FirebaseInstallations (~> 1.0)
- GoogleUtilities/Environment (~> 6.5)
- GoogleUtilities/UserDefaults (~> 6.5)
- GoogleAppMeasurement (6.2.1):
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
- GoogleUtilities/MethodSwizzler (~> 6.0)
- GoogleUtilities/Network (~> 6.0)
- "GoogleUtilities/NSData+zlib (~> 6.0)"
- nanopb (= 0.3.9011)
- GoogleDataTransport (3.3.0)
- GoogleDataTransportCCTSupport (1.3.0):
- GoogleDataTransport (~> 3.3)
- nanopb (~> 0.3.901)
- GoogleUtilities/AppDelegateSwizzler (6.5.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (6.5.0)
- GoogleUtilities/Logger (6.5.0):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (6.5.0):
- GoogleUtilities/Logger
- GoogleUtilities/Network (6.5.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (6.5.0)"
- GoogleUtilities/Reachability (6.5.0):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (6.5.0):
- GoogleUtilities/Logger
- nanopb (0.3.9011):
- nanopb/decode (= 0.3.9011)
- nanopb/encode (= 0.3.9011)
- nanopb/decode (0.3.9011)
- nanopb/encode (0.3.9011)
- PromisesObjC (1.2.8)
DEPENDENCIES:
- Firebase/Analytics
SPEC REPOS:
trunk:
- Firebase
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseCoreDiagnosticsInterop
- FirebaseInstallations
- FirebaseInstanceID
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleDataTransportCCTSupport
- GoogleUtilities
- nanopb
- PromisesObjC
SPEC CHECKSUMS:
Firebase: 5d77105d9740a07ca6b16927ca971db7e860faaf
FirebaseAnalytics: e83e64b1231dedcd9ddd4bdecd9bcfd6ba341679
FirebaseCore: 4aeb81ff53dcd9a3634ca725dc1fb8c2a4622046
FirebaseCoreDiagnostics: 5e78803ab276bc5b50340e3c539c06c3de35c649
FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850
FirebaseInstallations: 575cd32f2aec0feeb0e44f5d0110a09e5e60b47b
FirebaseInstanceID: 6668efc1655a4052c083f287a7141f1ead12f9c2
GoogleAppMeasurement: a08a43b8677b95ed51fcef880e36737334d804fd
GoogleDataTransport: 574a983e829327d7c18f2627f65d9e80164ea8a4
GoogleDataTransportCCTSupport: cad3cd6cdbdbad6b5c2c9206ec413402755faaaa
GoogleUtilities: f8de7ddf8c706f58e9b405d53e38bbdaa2731e5a
nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd
PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6
PODFILE CHECKSUM: c6bfafa3bd987a1301ca2facd9381380dccab887
COCOAPODS: 1.8.4
我的GoogleService-Info.plist存储在我的runner文件中,我通过Xcode将其放入其中,因此目标应该是正确的
pub spec.yaml文件:
name: testapp
description: A new Flutter project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
firebase_core: ^0.4.3+2
firebase_admob: ^0.9.0+10
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
名称:testapp
描述:一个新的颤振项目。
#下面定义了应用程序的版本和内部版本号。
#版本号是由点分隔的三个数字,如1.2.43
#后跟可选的内部版本号,以+分隔。
#版本和制造商编号都可能在颤振中被覆盖
#通过分别指定--build name和--build number来生成。
#在Android中,版本名用作版本名,而版本号用作版本代码。
#更多关于Android版本控制的信息,请访问https://developer.android.com/studio/publish/versioning
#在iOS中,生成名称用作CbundleShortVersionString,而生成编号用作CbundLeverVersion。
#阅读有关iOS版本控制的更多信息,请访问
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
版本:1.0.0+1
环境:
sdk:“>=2.1.0尝试以下步骤:
从ios
目录中删除.symlink
和Pods
文件夹
在终端中运行flatterclean
运行应用程序
如果有帮助,请告诉我。尝试以下步骤:
从ios
目录中删除.symlink
和Pods
文件夹
在终端中运行flatterclean
运行应用程序
让我知道它是否有用。您是在模拟器或物理设备上运行它?您是在模拟器或物理设备上运行它?