Swift: Conditional compilation flags must be valid. Swift identifiers
Today I downloaded XCode 9.0 Beta 4 and after building my project I get the following warning messages
<unknown>:0: error: conditional compilation flags must be valid Swift identifiers (rather than '-Xfrontend')
<unknown>:0: error: conditional compilation flags must be valid Swift identifiers (rather than '-debug-time-function-bodies')
Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
I have tried several options, for example I have searched for it here but cannot find a solution.
- Clear project
- Cleaning up the build folder
- Reloaded Xcode
- Rebooted laptop
Anyone on this?
+3
source to share
5 answers
At some point, you or a colleague turned on these flags to see how long it takes Xcode to take Swift files to compile. You can remove them as they do not affect compilation. Not sure if they are still supported, but if they are, it Active Compilation Conditions
no longer accepts the dash start format.
+3
source to share
This worked for me, hopefully this can help other people:
Steps:
- Click on your project name in the upper left corner.
- Make sure you choose your project, not goals
- Make sure the Debug / Release fields in Active Compilation Conditions contain "-Xfrontend" and / or "-debug-time-function-body", if so, try deleting them (perhaps write them down in case it doesn't work so you don't eat things anymore).
- Clean project, restart Xcode, and if you are using CocoaPods, run swap update
This is how I fixed my problem, which was almost the same as yours, hope it helps. Good luck.
+2
source to share