扑; Class AMSupportURLConnectionDelegate 在两者中都实现了 ?? (0x1eb0e27a0) 和 ?? (0x1162f02b8)

Flutter; Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1eb0e27a0) and ?? (0x1162f02b8)

Running pod install...                                              1.6s
Running Xcode build...                                                  
Xcode build done.                                            7.6s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[9381]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1eb0e27a0) and ?? (0x1162f02b8). One of the two will be used. Which one is undefined.
    objc[9381]: Class AMSupportURLSession is implemented in both ?? (0x1eb0e27f0) and ?? (0x1162f0308). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **


Xcode's output:
↳
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the precompiled application for the device.

我也试过删除 bin/cache 文件夹,但没有成功。 运行 在 M1 Mac.

我遇到了同样的问题。您可以尝试以下方法:

转到项目文件夹:

$ rm ios/Flutter/Flutter.podspec
$ flutter clean

适合我。

就我而言,我通过删除用于网络存储的 Firebase 库解决了问题。 由于某种原因,它与 iOS 版本冲突。

对我有用的解决方案。对不起,我之前没有post。

  1. 转到你的 flutter 项目
  2. 打开您的 runner.xcodeproj 文件夹
  3. 打开 contents.xcworkspace 文件,您将可以选择打开代码 ios 模块
  4. 运行 按播放按钮输入代码
  5. 构建将失败,因此请转到错误日志。真正的错误将在那里。 AMSupportURLConnectionDelegate 不是构建失败的真正原因。

出现此错误是因为 Xcode 测试版。

如果您使用的是 Firebase Auth,您可能会遇到此类问题,请将 X 代码版本更改为稳定版

change like this in your Podfile.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
    end
  end
end

Open your iOS folder in your X-code and find the file like this FIRAUTH DEFAULT DELEGATE

#import <TargetConditionals.h>
#if !TARGET_OS_OSX && !TARGET_OS_WATCH

then close the Xcode and try flutter run

如果它不起作用,你必须删除你的 pod 文件,然后再做 flutter 运行

对我来说,这是 firebase_crashlytics: ^0.2.3+1 引起的问题。注释掉这允许在模拟器上构建 运行.

我使用以下方法解决了这个问题:

  1. 备份项目中现有的 ios 文件夹

  2. 在您的主目录中创建一个新的 flutter 应用程序。

    flutter 创建my_app

  3. 将新创建的应用程序中的 ios 文件夹复制到现有项目中。

  4. 导航到项目文件夹和运行 使用 flutter 的应用程序 运行

    cd ~/我的项目 颤动 运行

我不确定它为什么起作用,但它确实起作用了。我的猜测是我在某处搞砸了配置文件或 plist 文件。