gpt4 book ai didi

ios - H。将Firebase添加到Flutter应用时找不到文件

转载 作者:行者123 更新时间:2023-12-01 22:10:04 32 4
gpt4 key购买 nike

我正在尝试为我的Flutter应用程序添加Firebase支持,但遇到一个问题,我在互联网上搜索了很多次,而且堆栈溢出,但根本没有任何解决方案。

有人说这是一些Swift问题,但我不确定。

以下是我尝试构建应用程序时从Android Studio获取的日志。

Launching lib/main.dart on iPhone XR in debug mode...
Running pod install...
Starting Xcode build...
Xcode build done. 14,4s
Failed to build iOS app
Error output from Xcode build:

** BUILD FAILED **


Xcode's output:

=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target.
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/ardacebi/Desktop/histic/histic/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'firebase_admob/FirebaseAdMobPlugin.h' file not found
#import <firebase_admob/FirebaseAdMobPlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Could not build the application for the simulator.
Error launching application on iPhone XR.

在我添加Firebase FlutterFire插件(需要它们时全部使用)阅读此指南后,便发生了这种情况:
  • https://firebase.google.com/docs/flutter/setup

  • 你们有什么解决方案吗?谢谢。

    我的一些文件可能会有所帮助

    播客文件
    # 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're not using Swift and don't want to use dynamic frameworks
    use_frameworks!

    # Pods for Runner

    pod 'Firebase'
    pod 'Firebase/Core'

    end

    pubspec.yaml
    name: histic
    description: Scientific discussion platform.

    # 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.
    # Read more about versioning at semver.org.
    version: 1.0.0+1

    environment:
    sdk: ">=2.0.0-dev.68.0 <3.0.0"

    dependencies:
    flutter:
    sdk: flutter
    firebase_core: ^0.3.0
    firebase_admob: ^0.8.0
    firebase_analytics: ^0.3.0
    firebase_auth: ^0.8.0+1
    firebase_database: ^2.0.0
    firebase_messaging: ^3.0.0
    firebase_dynamic_links: ^0.2.0
    firebase_ml_vision: ^0.3.0
    firebase_performance: ^0.1.0
    firebase_remote_config: ^0.1.0
    firebase_storage: ^2.0.0

    # The following adds the Cupertino Icons font to your application.
    # Use with the CupertinoIcons class for iOS style icons.
    cupertino_icons: ^0.1.2

    dev_dependencies:
    flutter_test:
    sdk: flutter


    # For information on the generic Dart part of this file, see the
    # following page: https://www.dartlang.org/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.io/assets-and-images/#resolution-aware.

    # For details regarding adding assets from package dependencies, see
    # https://flutter.io/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.io/custom-fonts/#from-packages

    AppDelegate.swift
    import UIKit
    import Flutter
    import Firebase


    @UIApplicationMain
    @objc class AppDelegate: FlutterAppDelegate {
    override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
    ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }
    }

    最佳答案

    这种情况是由Pod安装中断引起的。
    因此,首先您需要重新安装二进制文件,然后运行以下命令清除项目目录中的项目缓存:

    rm -rf "${HOME}/Library/Caches/CocoaPods"
    rm -rf "`pwd`/Pods/"
    然后重新安装,直到最后:
    pod install

    关于ios - H。将Firebase添加到Flutter应用时找不到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54447689/

    32 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com