Ok: So go to your Xcode then select File at the top and move to Workspace setting. A pop up will appear for you to update your workspace. If you have an updated Xcode go to advanced option and select legacy and press done. Happy Coding :)
My solution is to change the Derived Data folder to a directory with a shorter path. The Steps is as the following: Xcode -> File -> Workspace Settings... -> Select Custom Location for Derived Data and give a shorter path as the location.
출처 : error: unable to spawn process (Argument list too long) in Xcode Build