Cycle in dependencies between targets - Xcode 13.4.1

Hello, I am getting the following error only in Xcode 13.4.1.

Cycle in dependencies between targets '#aTargetName' and '#anotherTargetName'; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.

It gets solved if I "clean build folder" every time I need to run the project but it does not work every time.

This is how the build phases are in the project:

Does anyone know how to solve this issue?

Generally, the advice in the error message is accurate, and you can rearrange your target phases by dragging them around. In your screenshot, I don't see the right target phase types, as this looks like a screenshot of the app target and not the framework target's build phases. Check in your framework target's build phases instead.

Accepted Answer

The following line fix this:  Open Terminal and run:

defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1

Clean DerivedData:

cd ~/Library/Developer/Xcode rm -rf DerivedData

Clean Build Folder:

In Xcode: Product -> Clean Build Folder

Cycle in dependencies between targets - Xcode 13.4.1
 
 
Q