Xcode 中关于 Error: Multiple commands produce

更新 Xcode,自然开始第一时间运行老项目,踩坑填坑!!!

我这边记录下基本出现的问题:

Xcode 中关于 Error - Multiple commands produce

网上搜了一下找到下面的:

Build System

Again, Xcode 10 uses a new build system. The new build system provides improved reliability and build performance, and it catches project configuration problems that the legacy build system does not.
The legacy build system is still available in Xcode 10. To use the legacy build system, select it in the File > Project/Workspace Settings sheet. Projects configured to use the legacy build system will display an orange hammer icon in the Activity View.

简单而言,Xcode10使用了一个的新创建系统,比之前的提供更好的可靠性与创建性能,而且可以获取项目配置问题(默认设置新创建系统)

在苹果文档中,提及Xcode10中的关于旧项目New Build System更改适配中提及到以下两点:

The new build system has stricter checks for cycles between elements in the build in order to prevent unnecessary rebuilds.

It is an error for any individual file in the build to be produced by more than one build command. For example, if two targets each declare the same output file from a shell script phase, factor out the declaration of the output file into a single target.

New Build System会对构建中的元素循环进行严格的检查,避免不必要的重建,这个也是错误出现的原因。

简书上也有人提到这错误:https://www.jianshu.com/p/fdb1421f3c8b。(他的错误是 target -> Build phase > Copy Bundle Resource 中的 info.plist 导致的)

这个问题在 github 上也有,还是谷歌比较给力,链接 https://github.com/flutter/flutter/issues/20685。(他的错误是使用 Flutter.framework 库的时候导致的。)

总结上面几个讨论,错误发生的两种普遍形式:

  1. Copy Bundle Resources
  2. Copy Pods Resources

简书上的作者说 info.plist 导致的,不过 info.plist 也是在 Copy Bundle Resources 里面。而且我也查了这两个设置才找到了自己的错误:

Xcode 中关于 Error - Multiple commands produce 2

我还真想不起来为啥把 AMap 通过两种方法 import 了,而且以前也没遇到过类似的问题。

上面文章也提到了解决办法,综合一下我的方法,有两种:

1,Use the legacy build system

  • In Xcode, go to File->Project/Workspace settings.
  • Change the build system to Legacy Build system.

2,Use the new Xcode build system.

  • Open ios/xxx.xcworkspace
  • Select the Runner project in the project navigator sidebar.
  • In the main view, select the Runner target or framework, then select the Build Phases tab.
  • Expand the Copy Bundle Resources, Copy Pods Resources,or Embed Frameworks phase and select xxx.framework or xxx.bundle or info.plist.
  • Click - to remove from the list.

感谢!!!

发布了6 篇原创文章 · 获赞 2 · 访问量 1783

猜你喜欢

转载自blog.csdn.net/albert12336/article/details/105652134