Flutter iOS 错误Class AMSupportURLConnectionDelegate 在/usr/lib/libamsupport.dylib (0x203913130) 中实现

Flutter iOS Error Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib (0x203913130)

您好,我在 MacBook Air M1 芯片 Lap 中 运行 flutter 项目时遇到问题。尝试了所有的可能性都找不到确切的问题所在。

flutter clean, flutter pub get, pod deintegrate & install, flutter build ios, flutter run 这样的所有基本解决方案,但仍然是同样的问题。仅在未部署的 iOS 模拟器上。

对此的任何解决方案。提前致谢。

错误

Launching lib/main.dart on iPhone 13 in debug mode...
Running pod install...                                              5.3s
Running Xcode build...                                                  
Xcode build done.                                           104.1s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[25282]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib (0x203913130) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x103bc02c8). One of the two will be used. Which one is undefined.
    objc[25282]: Class AMSupportURLSession is implemented in both /usr/lib/libamsupport.dylib (0x203913180) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x103bc0318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **

flutter doctor -v

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.0.1 21A559 darwin-arm, locale
    en-IN)
    • Flutter version 2.8.1 at
      /Users/macsystem/Documents/developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (7 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/macsystem/Library/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] Connected device (2 available)
    • iPhone 13 (mobile) • 05EC9698-3C26-44B9-8DB0-B53C7B6576F3 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • Chrome (web)       • chrome                               • web-javascript
      • Google Chrome 97.0.4692.99

一段时间以来,我一直面临同样的问题。相同的设置在带有英特尔芯片的 mac 中运行良好。但是我什至重新设置了我的系统,m1 mac 仍然抛出同样的错误。

我遇到了同样的问题,但是我还有一个错误:

    Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
    deployment target versions is 9.0 to 15.2.99. (in target 'AppAuth' from project 'Pods')
    /Users/zack/Desktop/halseon/Merchant/halseon_merchants/ios/Pods/Pods.xcodeproj: warning: The iOS
    Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
    deployment target versions is 9.0 to 15.2.99. (in target 'GoogleSignIn' from project 'Pods')

解决这个问题:

  1. 在Xcode
  2. 中打开ios/Pods/Pods.xcodeproj
  3. 将 iOS 部署信息从 8.0 更改为 9.0

iOS Deployment info (Image Reference)

在控制台中,运行 'flutter run' 它应该 运行 iOS 模拟器中的应用程序。

我很幸运地先删除了 Flutter.podspec 然后 运行 扑通干净。我在 Mac 迷你 M1。

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

在此处找到:

https://github.com/flutter/flutter/issues/70895#issuecomment-744734693

我已经完成了以下步骤的彻底清理和安装,它帮助我解决了问题,

第 1 步:

flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm ios/Podfile

第 2 步:

cd ios
flutter pub get
pod cache clean --all
pod install

    or  (below for m1 chip incase above command thrown error in pod install)

#1 Install ffi
sudo arch -x86_64 gem install ffi

#2 Re-install dependencies
arch -x86_64 pod install

第 3 步:

1. Open ios/Pods/Pods.xcodeproj in Xcode
2. Change the iOS Deployment info from 8.0 to 9.0

第 4 步:

From xcode clean / build again / run. Hope this should work. Before please confirm whether all the build settings for iOS configured properly or not.

注意:在上述步骤中,我遇到了来自 Firebase 的另一个问题,例如“找不到 firebase 导入”。下面添加了我如何解决的步骤。

第一步:打开ios/Podfile

Check platform :ios, '10.0' is uncommented

第 2 步:

在 Podfile 末尾添加以下代码

target 'CustomImageNotifications' do
  use_frameworks!
  pod 'Firebase/Analytics'
  pod 'Firebase/Messaging'
end 

步骤 3: pod install & open xcode and clean / build.

希望这个回答对您有所帮助!谢谢

我通过 运行 通过兼容模式更新 pod

解决了这个问题
% flutter clean

% cd ios
% arch -x86_64 pod update