Can not run on device, but simulator can work well
1
Xcode's output:
2
3
note: Using new build system
4
note: Building targets in parallel
5
note: Planning build
6
note: Constructing build description
7
error: Building for iOS Simulator, but the linked and embedded framework 'App.framework' was built for iOS. (in target 'Runner' from project 'Runner')
8
9
Could not build the application for the simulator.
10
Error launching application on iPhone 11.
Copied!

Condition

Xcode >= 11.4

Quick Solved

rm -rf ios/Flutter/App.framework
Run this command and run project again.

Official Solved

  1. 1.
    From the Flutter app directory, open ios/Runner.xcworkspace in Xcode.
  2. 2.
    In the Navigator pane, locate the Flutter group and remove App.framework and Flutter.framework.
  3. 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.
4. 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
5. In the Runner target Build Settings > Other Linker Flags
(OTHER_LDFLAGS) add $(inherited) -framework Flutter
Hope it helps!
Last modified 1yr ago
Copy link