Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

xcode - Flutter - Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator

After updating to Catalina 10.15.4 beta with Xcode 13.4 beta, which also updated Simulator to 13.4 (921.4).

The application compiles and runs correctly on a physically attached device, but no simulators of any devices can pass this stage.

I got the errors

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.

enter image description here

How can I fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Xcode 11.4 changed the way frameworks are linked and embedded, and you may experience issues switching between iOS devices and simulators. Flutter v1.15.3 and later will automatically migrate your Xcode project.

To get unstuck, follow the instructions below;

  • Quick fix (make your simulator work)

rm -rf ios/Flutter/App.framework

  • Official recommended Steps to migrate manually

    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. enter image description here
    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.

enter image description here

  1. 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

enter image description here

  1. In the Runner target Build Settings > Other Linker Flags

    (OTHER_LDFLAGS) add $(inherited) -framework Flutter

enter image description here

Hope it helps!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...