Essence of chickens Essence of chickens - 1 year ago 138
Swift Question

Cocoa pod installation error: " The target overrides the SWIFT_VERSION build setting "

I'm trying to install Cocoalumberjack as a pod and am getting this error:

ProjectName [Release]
target overrides the
setting defined in `Pods/Target Support
Files/Pods-ProjectName/Pods-ProjectName.release.xcconfig'. This can
lead to problems with the CocoaPods installation

The pod xcconfig file contains this:


But my project is already using swift 3. so I don't understand why there's this mismatch.

xcrun swift -version

Apple Swift version 3.0 (swiftlang-800.0.46.2

However I cannot see a SWIFT_VERSION in particular anywhere in Xcode's build settings, nor if I type in swift as the search term in the Xcode's build settings can I see anything anywhere that even looks like a swift version number

Additionally the pod installation goes on to say:"Use the
flag" to solve the problem.
However my Xcode build settings other linker flags already has this $(inherited) flag, so why is that not solving the problem?

(Xcode 8)

Answer Source

It is a bit non-intuitive but what you have to do is:

1) Search for "SWIFT_VERSION" in your project settings

2) you will see an entry saying "Use Legacy Swift Language Version"

  • If you had already selected any value it will be shown in BOLD

3) Select the entry (not the value) and press "DELETE", the boldness should disappear.

4) Repeat the same steps but now for your target (the one with the app icon)

5) Close XCode

6) Run "pod install" again

7) Open your project, and CLEAN IT (Shift + Command + K)

Now it should be working correctly.


Specifically for "Cocoalumberjack" make sure your pod is installing the 3.0+ version, if its not run a "sudo pod update" as versions previous to this won't work with Swift 3.


I'm pretty sure the cocoapods handling of this is a bit buggy at the moment, as I've experienced sometimes it works and others it doesnt. However, keep in mind you can set the "SWIFT_VERSION" flag directly on a per framework basis:

1) Select the Pods project (within your project).

2) Select the target that you want to set and look for the "SWIFT_VERSION" flag specifically for that target.

3) Clean and rebuild.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download