Flutter - 为 iOS 构建,但链接和嵌入式框架“App.framework"是为 iOS 模拟器构建的 [英] Flutter - Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator

查看:31
本文介绍了Flutter - 为 iOS 构建,但链接和嵌入式框架“App.framework"是为 iOS 模拟器构建的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 Xcode 13.4 beta 更新到 Catalina 10.15.4 beta 之后,它也将 Simulator 更新到 13.4 (921.4).

应用程序在物理连接的设备上编译并正确运行,但没有任何设备的模拟器可以通过此阶段.

我遇到了错误

<块引用>

为 iOS 构建,但链接和嵌入式框架App.framework"是为 iOS 模拟器构建的.

<块引用>

为 iOS 模拟器构建,但链接和嵌入式框架App.framework"是为 iOS 构建的.

我该如何解决这个问题?

解决方案

Xcode 11.4 改变了框架的链接和嵌入方式,您可能会遇到在 iOS 设备和模拟器之间切换的问题.Flutter v1.15.3 及更高版本将自动迁移您的 Xcode 项目.

要摆脱困境,请按照以下说明进行操作;

  • 快速修复(让您的模拟器正常工作)

rm -rf ios/Flutter/App.framework

  • 在 Runner 目标构建设置 Build Phases > Link Binary With Libraries 中,确认 App.framework 和 Flutter.framework 不再存在.还要在构建阶段 > 嵌入框架中确认.

  1. 更改 Runner 目标构建设置 Build Phases > Thin Binary 脚本,如下所示:

    <块引用>

    /bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh"嵌入

    /bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh"薄

  1. 在 Runner 目标中 Build Settings > Other Linker Flags

    (OTHER_LDFLAGS) 添加 $(inherited) -framework Flutter

希望能帮到你!

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.

How can I fix this?

解决方案

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

  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

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

    (OTHER_LDFLAGS) add $(inherited) -framework Flutter

Hope it helps!

这篇关于Flutter - 为 iOS 构建,但链接和嵌入式框架“App.framework"是为 iOS 模拟器构建的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆