Flutter - Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator

后端 未结 9 1532
生来不讨喜
生来不讨喜 2020-12-24 11:57

After updating to Catalina 10.15.4 beta with Xcode 13.4 beta, which also updated Simulator to 13.4 (921.4).

The application compiles and runs correctly on a physical

相关标签:
9条回答
  • 2020-12-24 12:37

    I have tried the solution on the official website of flutter but it didn't work for me, so I found a temporary solution which worked for me, but it took me some hard works: Here is my example with project stuck_framework which is a fresh new project (first time run on the simulator)

    1. I created 2 folders inside flutter project called
      "ios_simulator" and "ios_real_device". enter image description here

    2. Now my first build was for the simulator, then I want to switch to a real device, I will move ios folder inside Flutter project to the "ios_simulator"

    3. I open the project with visual studio code and run "flutter create ." and now I will choose a real device to rebuild the project ( if your simulator is online, please quit ). enter image description here
    4. Now I wait for the build finish and run on the real device without any errors. Now I have 2 ios project 1 for simulators and one for real devices.
    5. Next time when I want to run on the simulator again, I just remove the current ios folder and copy the ios folder which I placed on "ios_simulator" back out to flutter project folder. Hope this help
    0 讨论(0)
  • 2020-12-24 12:38

    Manually upgrading flutter to version 1.15 solve this issue as well. Running flutter version v1.15.17 helped me.

    Also, you can switch to beta or dev channels by running flutter channel command but be sure you check your code against all BC changes...

    0 讨论(0)
  • 2020-12-24 12:39

    Xcode 11.4 changed the way frameworks are linked and embedded, and you may experience issues switching between iOS devices and simulators. Flutter v1.15.3 and later will automatically migrate your Xcode project.

    To get unstuck, follow the instructions below;

    • Quick fix (make your simulator work)

    rm -rf ios/Flutter/App.framework

    • Official recommended Steps to migrate manually

      1. From the Flutter app directory, open ios/Runner.xcworkspace in Xcode.
      2. In the Navigator pane, locate the Flutter group and remove App.framework and Flutter.framework.
      3. In the Runner target build settings Build Phases > Link Binary With Libraries confirm App.framework and Flutter.framework are no longer present. Also confirm in Build Phases > Embed Frameworks.

    1. Change the Runner target build settings Build Phases > Thin Binary script as follows:

      /bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed

      /bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" thin

    1. In the Runner target Build Settings > Other Linker Flags

      (OTHER_LDFLAGS) add $(inherited) -framework Flutter

    Hope it helps!

    0 讨论(0)
  • 2020-12-24 12:43

    None of the other solutions here worked for me. In my case, the problem was fixed by searching my project for ONLY_ACTIVE_ARCH and changing them all to YES. I found my solution here:

    https://developer.apple.com/forums/thread/656509

    0 讨论(0)
  • 2020-12-24 12:46

    Xcode 11.4 changed the way frameworks are linked and embedded, which is causing issues switching between iOS devices and simulators.

    Please follow official guide on how to migrate your project.

    0 讨论(0)
  • 2020-12-24 12:47

    This error is caused by the Xcode 11.4 and can be resolved by Removing / Re-Embedding frameworks and adding a new Run Script Phase.

    • Under General -> "Frameworks, Libraries, and Embedded Content"

      • Delete the frameworks that are causing errors.
      • After deleting, re-embed the frameworks in the same location.
    • Under Build Phases add a new run script phase.

      • Select the "+" button in the "Build Phases" pane to create a "New Run Script Phase".

      • Confirm the script is the bottommost build phase, and configure its fields.

        • The Shell text field should read /bin/sh (which is the default value).
        • In the text-input area, enter the shell command rm -r "FRAMEWORK_DIRECTORY/YOUR_FRAMEWORK.framework/"

    0 讨论(0)
提交回复
热议问题