微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我的 Flutter 应用程序拒绝在 IOS 模拟器上运行

如何解决我的 Flutter 应用程序拒绝在 IOS 模拟器上运行

当我尝试在 M1 mac 上的 ios 模拟器上运行我的应用程序时,我不断收到以下错误

Xcode's output:
↳
    <unkNown>:0: error: merge-module command Failed with exit code 1 (use -v to see invocation)
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/
    iPhonesimulator14.5.sdk/usr/include/CommonCrypto/module.modulemap:1:8: error: redeFinition of
    module 'CommonCrypto'
    module CommonCrypto [system] [extern_c] {
           ^
    /Users/me/Desktop/project/job/ios/Pods/SCrypto/Frameworks/iphonesimulator/CommonCrypt
    o.framework/module.map:1:8: note: prevIoUsly defined here
    module CommonCrypto [system] {
           ^
    Command MergeSwiftModule Failed with a nonzero exit code
    Command CompileSwift Failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
    warning: Capabilities for Signing & Capabilities may not function correctly because its
    entitlements use a placeholder team ID. To resolve this,select a development team in the
    Runner editor. (in target 'Runner' from project 'Runner')

Xcode 版本:12.5 可可豆:1.10.0.

Flutter Doctor 输出

[✓] Flutter (Channel dev,2.3.0-0.1.pre,on macOS 11.3.1 20E241 darwin-arm,locale en-NG)
    • Flutter version 2.3.0-0.1.pre at /Users/me/Flutter
    • Upstream repository https://github.com/Flutter/Flutter.git
    • Framework revision d72bfb8d07 (11 days ago),2021-04-26 06:05:55 -0700
    • Engine revision de6e1adf97
    • Dart version 2.14.0 (build 2.14.0-18.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/moses/Library/Android/sdk
    • Platform android-30,build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5,Build version 12E262
    • CocoaPods version 1.10.0

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

[✓] Android Studio (version 4.2)
    • 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.8+10-b944.6916264)

[✓] VS Code (version 1.56.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.22.0

[✓] Connected device (2 available)
    • iPhone 12 Pro Max (mobile) • 7561F67B-74C8-464F-8191-E5A09B83F01B • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • Chrome (web)               • chrome                               • web-javascript • Google
      Chrome 90.0.4430.93

• 未发现问题!

Android 运行良好,无论我使用哪个颤振频道,问题仍然存在。

我已经尝试了一切,在过去的 48 小时内我几乎没睡过,试图解决这个问题。任何帮助将不胜感激。

解决方法

只需在您的 swift 文件中添加 import CommonCrypto。我希望这能解决问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。