Swift: conditional compilation flags must be valid Swift identifiers

Viewed 4808

Today i downloaded the XCode 9.0 Beta 4 and after building my project i get the next 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 like i have searched it here but cannot find any solution to this.

  • Cleaned the project
  • Cleaned the build folder
  • Restarted XCode
  • Restarted laptop

Anyone on this?

5 Answers

This issue appeared for me, while I started the app for the first time in Xcode 9.

I had duplicated values in Build Settings -> Other Swift Flags. After removal of duplications the app started to work as expected.

Duplicated values

Other Swift Flags cannot have a value that contains a dash "-", but in Swift 3.2 the values do need a "-D" prefix

Related