error: conditional compilation flags must be valid Swift identifiers (rather than 'DEBUG”')

风流意气都作罢 提交于 2019-12-08 03:02:08

问题


I'm trying to build my project with Xcode 9 beta 6 (9M214v). Also, I'm using CocoaPods. I've converted to Swift 4 and updated my project settings, but I keep getting this error.

Things I've tried so far:

  • Clean project and build folder
  • Deleting / re-adding pods
  • Restart Xcode
  • Remove Active Compilation Conditions flags

Anyone has an idea how to solve this?

Error message:

<unknown>:0: error: conditional compilation flags must be valid Swift identifiers (rather than 'DEBUG”')
Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

Podfile

target 'iOS Application' do
    use_frameworks!

    pod 'SwiftLint'
    pod 'RealmSwift'
    pod 'ReachabilitySwift'
    pod 'Fabric'
    pod 'Crashlytics'
end

回答1:


Found the error! In my iOS Application target's Build Settings, at Swift Compiler - Custom Flags > Other Swift Flags. There was a ”, instead of " at the end of the flag. I have no idea how this happened, but the quotation mark caused the error.




回答2:


I find when you modify your "x-Code" setting for custom flags "Debug" to delete "-D",and then replace your swift language version to "Swift 4.0" ,It will fix your problem! Hoping help you...



来源:https://stackoverflow.com/questions/45876616/error-conditional-compilation-flags-must-be-valid-swift-identifiers-rather-tha

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!