今天在升级Flutter后在vscode运行报错:
Your Xcode project requires migration. See https://flutter.dev/docs/development/ios-project-migration for details.
Error launching application on iPhone 11 Pro.
在Xcode(v11.4.1)里运行倒是没有问题......
想到之前flutter升级时:
Your flutter checkout has local changes that would be erased by upgrading. If
you want to keep these changes, it is recommended that you stash them via "git
stash" or else commit the changes to a local branch. If it is okay to remove
local changes, then re-run this command with --force.
直接终端:flutter upgrade --force,而没有保存本地的修改......
也不知道是不是这个锅
于是,
根据Flutter官网https://flutter.dev/docs/development/ios-project-migration的说明,需要手动配置支持Xcode11.4。
-
1.用Xcode打开项目(ios/Runner.xcworkspace ),在Flutter文件下删除App.framework 和 Flutter.framework的引用,如图:
删除两个frameworkde 引用 - 2.然后在 Runner target build settings Build Phases >Link Binary With Libraries和Build Phases > Link Binary With Libraries中确认是否删除了: 确认是否删除
- 3.在 Runner target build settings 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
- 4.在Runner target Build Settings > Other Linker Flags(OTHER_LDFLAGS) 添加
$(inherited) -framework Flutter.
我的原来就是有的,如果没有把它添加进去:
Other Linker Flags配置
这样就把Xcode11.4的支持搞定了,验证一下:
网友评论