This article is for you who are still in Flutter’s stable branch (Channel stable, v1.12.13 + hotfix.9 or smaller) or when building an App you get the following error:
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.
To fix the above error, you follow my instructions step by step below:
- Open the ios / Runner.xcworkspace file in your Flutter project
- You look over the Navigation Pane of XCode, inside the Flutter folder you will see App.framework and Flutter.framework .
- Gently remove them by Select -> right mouse -> Delete.
After removing, select Target Runner -> Build Phases> Link Binary With Libraries and Embed Frameworks to ensure that there are no more App.framework and Flutter.framework files.
Still in that build Phases , select Thin Binary and add the following script:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" thin
And finally, you select Target Runner -> Other Linker Flags , add the following lines if not $ (inherited) -framework Flutter
Finally, if you still do not understand the components in XCode, I will give you a picture of all the components in XCode that we often use without paying attention.
Note : Flutter v1.15.3 and later versions have automatically migrated to your XCode project.
If you want to see quality posts, or discuss your insights, share your insights with others, join our group on Facebook : ^^