CocoaPods issue (and fix) with Xcode 8

Now that more and more teams migrate to use Xcode 8 we saw a couple of frequent issues reported by our users. One of the most frequent ones is related to CocoaPods and the Swift version.


Now that more and more teams migrate to use Xcode 8 we saw a couple of frequent issues reported by our users.

One of the most frequent ones is related to CocoaPods and the Swift version. The error looks something like:

** ARCHIVE FAILED **

The following build commands failed:
   Check dependencies

The first step if you get an error like this and you don't see more details about the error in the log, is to switch the Output Tool option of the related Xcode step to xcodebuild. The default value is xcpretty, which is an awesome Xcode log formatter tool, but in some cases it omits important details about the error.

In the raw xcodebuild log if you have an error like:

Check dependencies
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

and you use CocoaPods, the most likely cause of the error is that CocoaPods might not set your pod projects' swift version correctly.

You can find the related CocoaPods issue on GitHub, and as mentioned there the fix is to add the following code to your Podfile:


post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '2.3'
    end
  end
end
Copy code

Huge thanks for @snydersaurus who reported this and the fix on our Slack!

Happy Building! 🚀

No items found.

Explore more topics

App development

Best practices from engineers on how to use Bitrise to build better apps, faster.

Community

Meet other Bitrise engineers, technology experts, power users, partners and join our BUGs.

Company

All the updates about Bitrise events, sponsorships, employees, and more.

Insights

Mobile development, latest tech, industry insights, and interviews with experts.

Mobile DevOps

Learn why mobile development is unique and requires a set of unique practices.

Releases

Stay tuned for the last updates, new features, and product improvements.

Get the latest from Bitrise

Join other Mobile DevOps engineers who receive regular emails from Bitrise, filled with tips, news, and best practices.