You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter iOS构建报错AMSupportURL类重复实现 常规修复方案无效求助

报错信息

objc[14025]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1efb7ac10) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x12c2b82b8). One of the two will be used. Which one is undefined.
objc[14025]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1efb7ac60) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x12c2b8308). One of the two will be used. Which one is undefined.
** BUILD FAILED **

已尝试方案
  • 在项目目录下执行flutter clean
  • 执行flutter pub get后运行pod update
  • 单独执行pod update
  • 执行pod repo update
  • 重启Xcode与Mac设备
  • 执行pod install
  • 执行flutter build ios
可行解决思路

该报错属于Xcode 14+版本常见的系统库类名重复冲突触发的编译失败,上述类重复提示本身属于系统级警告,正常不会阻断编译,绝大多数情况是链接器或架构配置异常导致警告被升级为错误拦截了编译流程,可按以下步骤排查:

  1. Xcode 15+链接器配置修复
    打开项目ios目录下的Podfile,在post_install代码块中添加以下配置,强制使用旧版链接器并关闭相关警告拦截:
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          # 强制使用旧版链接器解决新链接器误判错误
          config.build_settings['OTHER_LDFLAGS'] ||= []
          config.build_settings['OTHER_LDFLAGS'] << '-ld64'
          # 关闭警告视为错误配置
          config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'NO'
          config.build_settings['SWIFT_TREAT_WARNINGS_AS_ERRORS'] = 'NO'
        end
      end
    end
    
  2. 模拟器架构排除配置
    如果是M系列芯片的Mac设备,需要在Xcode项目的Build Settings中,找到Excluded Architectures选项,在Any iOS Simulator SDK的配置下添加arm64;同时在Podfile的post_install块内补充以下配置,同步Pods项目的架构规则:
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
    
  3. 全量缓存清理重建
    执行以下命令全量清理旧编译产物后重新构建:
    flutter clean
    rm -rf ios/Pods ios/Podfile.lock ios/Runner.xcworkspace
    flutter pub get
    cd ios && pod install --repo-update
    cd .. && flutter run -d ios
    
  4. 依赖兼容性排查
    检查pubspec.yaml中所有第三方依赖的版本,升级至支持你当前Xcode版本的最新稳定版,部分老旧的原生iOS插件会触发该类编译冲突。

内容的提问来源于stack exchange,提问作者Mohammed Niyaz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.30 00:24:01