Cycle inside ; building could produce unreliable results: Xcode Error

For anybody having an issue with Xcode 10 build system, follow the following steps to fix it:

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

It will resolve the build issue with the new Xcode.

If you want to work with the new build system, then you can find the troubleshooting help from this apple Xcode help page.


I was having this issue with Cocoapods. The solution was to clean the build folder re-install all pods, and then rebuild the app. The issue resolved itself that way.


I fixed my problem by moving the 'Copy Bundle Resources' Build Phase before all my 'Copy Files' & 'Link Binary with Libraries' Build Phases


In fact, you only need to pay attention to Xcode's prompt This usually can be resolved by moving the target's Headers build phase before Compile Sources, and then you can do it.

When I encountered this problem, Xcode prompts me:

:-1: Cycle inside XXXX; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.
Cycle details:
→ Target 'XXXX': LinkStoryboards
○ Target 'XXXX: Ditto Path/XXXX-Swift.h /Path/XXXX-Swift.h
○ Target 'XXXX has compile command for Swift source files
○ That command depends on command in Target 'XXXX: script phase “Run Script”

I only did one thing and solved the problem perfectly:

Select Target and then select Build Phase to move the Run Script to the front of Compile Sources.

Run, compiled successfully.

The principle is simple, just change the compilation order.

image 1

Xcode 10.2 & Swift 5