3
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 上运行。

4

6 回答 6

1

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

于 2021-01-12T16:39:58.933 回答
1

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

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

  2. 在你的主目录中创建一个新的颤振应用程序。

    颤振创建 my_app

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

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

    cd ~/myproject 颤振运行

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

于 2021-05-31T12:01:20.137 回答
0

由于 Xcode beta 版本而发生此错误。

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

在您的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

在 X 代码中打开您的 iOS 文件夹并找到类似FIRAUTH DEFAULT DELEGATE的文件

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

然后关闭Xcode并尝试flutter run

如果它不起作用,您必须删除您的 pod 文件,然后再次执行 flutter run

于 2021-03-07T17:21:06.290 回答
0

对我有用的解决方案。抱歉我没有早点发帖。

  1. 去你的颤振项目
  2. 打开你的 runner.xcodeproj 文件夹
  3. 打开 contents.xcworkspace 文件,您将可以选择在代码上打开 ios 模块
  4. 按播放按钮运行您的代码
  5. 构建将失败,因此请转到错误日志。真正的错误将在那里。AMSupportURLConnectionDelegate 不是构建失败的真正原因。
于 2021-03-07T16:28:32.743 回答
0

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

转到项目文件夹:

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

为我工作。

于 2020-12-19T12:55:23.253 回答
0

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

于 2021-05-12T01:07:15.303 回答