Error: ‘App.framework was built for iOS Simulator’

  • Post category:ios
  • Post comments:1 Comment
  • Reading time:4 mins read

Recently I picked up Flutter and I must say I am simply loving every widget of it :D. However, in between, I had to upgrade my MacOS to Catalina and with it, I also had to upgrade the XCode to 11.4. And with that I started hitting the below error message:

error: Building for iOS, but the linked and embedded framework ‘App.framework’ was built for iOS Simulator. (in target ‘Runner’ from project ‘Runner’)

It was confusing and frustrating initially, as I was in the middle of a project delivery milestone and now I had to deal with this unexpected upgrade issue.

Anyways, with some findings, I got to know that it’s more of a compatibility issue that got introduced as XCode 11.4 onwards XCode handles the embedding and linking of frameworks differently. So now the Flutter framework has to handle this scenario. Actually as per their update, with Flutter ver 1.15.x onwards it’s fixed.

But I can not switch my Flutter version and luckily the Flutter docs have also provided a workaround solution to this issue, but I failed in following the steps myself on the first try. Here is the Official link.

So, I am adding the steps here, mainly for myself to get reminded of the steps for future projects until I upgrade my Flutter version. And if it helps somebody then well and good.

Step 1: Open your project in XCode

Step 2: Delete the App.framework and Flutter.framework as shown below.

Just choose Remove References
Just choose “Remove References”

Step 3: Now go to Build Phases > Thin Binary and replace the contents with

/bin/sh “$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh” embed

/bin/sh “$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh” thin

Step 4: Lastly, go to Build Settings tab and look for ‘Other Linkage Flags’

Tip: You can quick search for ‘LDFlags’.

And add the following one by one, as shown in the gif below.

$(inherited) -framework Flutter

And that’s it, your project should build fine for both physical device and simulator.

Hope this post helps you.

Take care !

Share the post, if you liked it

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This Post Has One Comment

  1. garfield

    This is really interesting, You’re a very skilled blogger.
    I have joined your feed and look forward to seeking more of your fantastic post.
    Also, I have shared your website in my social networks!