How to resolve "Cycle inside..." build error in xcode

Viewed 24

After migrating a project from Xcode 12.4 running Catalina 10.15.5, I'm now running Xcode 13.4.1 on Monterey 12.5.1. Before the migration, there was no such error.

If I do Product > Clean Build Folder, the project builds and runs normally. But if I initiate another build, which I'm directing to the simulator as it happens, I get the following:

Cycle inside Cosmos; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.

When I click the top level item in the project navigator, then select the target, and then build phases I'm in unfamiliar territory; I have never manually done anything in this area of Xcode. I'm not sure what to do.

1 Answers

You need to not just look at the target for your own code, but also the targets from libraries that your code uses.

From Project navigator, select Pods. You should see a target Cosmos. Select that, then select Build Phases. You will see Headers and Compile Sources. Drag the Headers entry above Compile Sources. Repeat this process with any other Pods that your project uses, and this should satisfy the build process so that it no longer complains about "Cycle inside..."

Related