美文网首页Flutter开发学习拣选文章
升级Flutter提示Your Xcode project re

升级Flutter提示Your Xcode project re

作者: pipiOU | 来源:发表于2020-05-25 17:31 被阅读0次

    今天在升级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 LibrariesBuild 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的支持搞定了,验证一下:

    在Xcode中运行项目没有问题: Xcode运行 在vscode中运行没有问题: vscode运行

    相关文章

      网友评论

        本文标题:升级Flutter提示Your Xcode project re

        本文链接:https://www.haomeiwen.com/subject/bcuyihtx.html