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


This problem appeared for me when I first launched the application in Xcode 9.

I had duplicate values ​​in Build -> Other Swift Flags settings. After removing the duplicates, the application started working as expected.



Duplicate values

+5


source


Find the following in your project settings and individual target settings:

Other quick flags



Delete it. Compilation.

+4


source


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


Other Swift flags cannot have a value containing a dash "-", but in Swift 3.2 values ​​need the "-D" prefix

+3


source


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.

1]

+2


source







All Articles