Xcode Migration

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.

or

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:

  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.

    Remove Frameworks in Xcode Navigator
  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.

    Confirm Frameworks Removed from Build Phases
  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
    
    Update Thin Binary Script Build Phase
  5. In the Runner target Build Settings > Other Linker Flags (OTHER_LDFLAGS) add $(inherited) -framework Flutter.

    Update Other Linker Arguments Build Setting