简体   繁体   English

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

[英]My Flutter app refuses to run on an IOS Simulator

I keep getting the following error when i try running my app on an ios simulator on an M1 mac当我尝试在 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 version: 12.5 Cocoapods: 1.10.0. Xcode 版本:12.5 Cocoapods:1.10.0。

Flutter Doctor output Flutter 博士 output

[✓] 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

• No issues found! • 未发现任何问题!

Android works fine and the issue persists no matter what flutter channel i'm on. Android 工作正常,无论我在哪个 flutter 频道,问题仍然存在。

I have tried EVERYTHING, i have barely slept in the last 48hrs trying to fix this.我已经尝试了一切,我在过去的 48 小时内几乎没有睡觉,试图解决这个问题。 Any help would be greatly appreciated.任何帮助将不胜感激。

Just add import CommonCrypto in your swift file.只需在 swift 文件中添加import CommonCrypto即可。 I hope this will do the trick.我希望这能解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM