To develop Flutter apps for iOS, you need a Mac with Xcode installed. Xcode 11.4 changed the way frameworks are linked and embedded, and you may see the following errors when switching between iOS devices and simulators:
Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator.
Building for iOS Simulator, but the linked and embedded framework 'App.framework' was built for iOS.
Flutter v1.15.3 and later automatically migrates your Xcode project.
If you need to manually upgrade your project, use the following steps:
From the Flutter app directory, open
In the Navigator pane, locate the Flutter group and remove
In the Runner target build settings Build Phases > Link Binary With Libraries confirm
Flutter.frameworkare no longer present. Also confirm in Build Phases > Embed Frameworks.
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
In the Runner target Build Settings > Other Linker Flags (
$(inherited) -framework Flutter.