Как исправить фатальные ошибки при работе с firebase для iOS разработки? - PullRequest
0 голосов
/ 20 января 2020

Во-первых, я работаю в Visual Studio Code. Но это не должно быть проблемой, так как код по умолчанию, который поставляется с Flutter SDK, отлично работает в симуляторе 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 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

My Доктор флаттера:

[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 хранится у моего бегуна файл, который я вставил туда через XCode, чтобы цели были правильными.

pub spe c .yaml file:

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

Мой код работал нормально, пока я не начал добавлять FireBase зависимости в моем файле pubspe c .yaml.

1 Ответ

0 голосов
/ 23 февраля 2020

Попробуйте выполнить следующие действия:

  1. Удалите .symlink и папку Pods из каталога ios.
  2. Запустите flutter clean на своем терминале.
  3. Запустите приложение.

Дайте мне знать, если это поможет.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...