我的项目有多个目标。更新 Xcode 后,我选择执行 Swift 迁移到最新版本。我成功执行了迁移,但结果只针对一个目标。
因此,我按照本迁移指南底部的说明进行操作:https://swift.org/migration-guide-swift4
If you have multiple schemes in your project that cover different targets, you will only get notified that you need to migrate one of them. You will need to manually select the new scheme, then run Edit -> Convert -> To Current Swift Syntax to migrate the remaining schemes.
但是,我收到错误:
但是,由于我执行了迁移并且目标共享文件,我现在遇到了大量错误,导致我无法成功构建。
我不知道如何继续。
最佳答案
我也遇到了同样的问题,但是 migration guide实际上提到了这个问题的另一种解决方案。
If you have multiple schemes in your project that cover different targets, you will only get notified that you need to migrate one of them. You will need to manually select the new scheme, then run Edit -> Convert -> To Current Swift Syntax to migrate the remaining schemes. Or you can create a scheme that includes all the targets from your project, and have it selected before running the migration assistant.
所以继续创建一个新方案。它只允许您在创建目标时添加单个目标。然后编辑该新方案并添加您拥有的其余目标。使用迁移工具同时迁移所有目标。完成后删除您创建的方案。
关于swift - 具有多个目标的 Xcode Swift 4.2 迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52542645/