升级Xcode11.4导致Flutter项目报错Building for iOS, but the linked and embedded framework 'App.framework'的处理

之前Flutter项目都妥妥的,升级Xcode11.4后却报错。

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

别急,首先Clean下项目,在项目根目录下:

flutter clean

然后删除ios/Flutter/App.framework:

rm -rf ios/Flutter/App.framework

再次运行,应该就OK了。

如果还是不行的话,双击ios/Runner.xcworkspace。在Xcode左侧Navigator中,删除App.framework和Flutter.framework
升级Xcode11.4导致Flutter项目报错Building for iOS, but the linked and embedded framework 'App.framework'的处理_第1张图片
Runner Target -> Build Phases -> Link Binary With LibrariesEmbed Frameworks中,确认下图红框中没有App.framework和Flutter.framework

Build Phases -> Thin Binary中的脚本改为如下:

/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" thin

升级Xcode11.4导致Flutter项目报错Building for iOS, but the linked and embedded framework 'App.framework'的处理_第2张图片
切换到Runner TargetBuild Settings面板,双击Other Linker Flags项,在弹出窗口中点击**+**号,并输入:

$(inherited) -framework Flutter

升级Xcode11.4导致Flutter项目报错Building for iOS, but the linked and embedded framework 'App.framework'的处理_第3张图片

你可能感兴趣的:(Flutter,iOS开发)