【问题标题】:Mac M1 -- Error launching application on iPhone 12 Pro Max.(Flutter.h and AMSupportURLConnectionDelegate, AMSupportURLSession) issueMac M1 -- 在 iPhone 12 Pro Max 上启动应用程序时出错。(Flutter.h 和 AMSupportURLConnectionDelegate、AMSupportURLSession)问题
【发布时间】:2021-11-17 16:08:59
【问题描述】:

我是 Flutter 的 ios 开发新手。尝试在 ios 模拟器和外部设备 (iphone xr) 上构建应用程序时,出现以下错误--

objc[50354]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f3d2c188) and ?? (0x1184482b8). One of the two will be used. Which one is undefined.
    objc[50354]: Class AMSupportURLSession is implemented in both ?? (0x1f3d2c1d8) and ?? (0x118448308). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **

Xcode's output:
↳
    FirebaseAnalytics-framework-aginbutuetuehmfqavbftszulegx
    /Users/.../ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'cloud_firestore' not found
    @import cloud_firestore;
     ~~~~~~~^~~~~~~~~~~~~~~
    1 error generated.
    FirebaseAnalytics-framework-aginbutuetuehmfqavbftszulegx
    /Users/.../ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'cloud_firestore' not found
    @import cloud_firestore;
     ~~~~~~~^~~~~~~~~~~~~~~
    1 error generated.
    FirebaseAnalytics-framework-aginbutuetuehmfqavbftszulegx
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.

除此之外,我在 XCode AppDelegate.swift 中遇到错误,它说——“Flutter.h not found”

我在这个问题上被困了 2 周,并且已经尝试了几乎所有可用的解决方案。

请帮忙!

问候

【问题讨论】:

    标签: ios xcode flutter apple-m1 flutter-ios


    【解决方案1】:

    使用 M1 Apple Silicon 芯片,您可能会遇到那些 compiling errors 关于 Class AMSupportURLConnectionDelegateAMSupportURLSession Class 被实施两次的问题:

    我解决此问题的技巧是使用 Rosetta 并在 Flutter 项目中重新创建一些文件。

    这是怎么做的:

    确保您的 XCode Proj 中有正确的 Apple 配置文件。 (用于代码签名)
    确保你是opening terminal using Rosetta and not with ARM/Native

    然后,只有这样,尝试运行此命令:

    flutter clean && rm ios/Podfile ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace && flutter run
    

    【讨论】:

    • 感谢您的回复。我通过结合包括您的答案在内的方法解决了这个问题。事实证明,这是 M1 中的一个问题,因为它严重依赖缓存。对我有用的是使用系统的终端(我之前通过 android studio 使用终端)并在那里运行我的所有命令。我不得不清除系统缓存(通过清理 ~/Library/Caches),因为我所做的很多更改都没有反映出来,因为缓存没有改变。因此,为什么最常见的解决方案是重新创建 iOS 文件夹。通过遇到这个问题,我学到了很多关于 mac 和 M1 的知识。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-12
    • 2020-04-12
    • 1970-01-01
    • 2022-01-22
    • 2021-08-02
    • 2021-09-19
    • 2022-10-12
    相关资源
    最近更新 更多