Cocoapods: pod install fails with "There may only be up to 1 unique SWIFT_VERSION per target. Found target(s) with multiple Swift versions:"

Created on 6 Dec 2017  路  5Comments  路  Source: CocoaPods/CocoaPods

Report

What did you do?

Run "pod install"

What did you expect to happen?

I expect CocoaPods to install.

What happened instead?

Pods fail to install:

 $ pod install
Analyzing dependencies
[!] There may only be up to 1 unique SWIFT_VERSION per target. Found target(s) with multiple Swift versions:
My App: Swift
My App: Swift 4.0

CocoaPods Environment

Stack

   CocoaPods : 1.4.0.beta.2
        Ruby : ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin17]
    RubyGems : 2.6.13
        Host : Mac OS X 10.13.1 (17B1003)
       Xcode : 9.2 (9C40b)
         Git : git version 2.14.1
Ruby lib dir : /Users/dan/.rbenv/versions/2.4.2/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 79ac7bd97bcfed87b5612527d2834556c399b97f
               wepay - [email protected]:wepay/mobile-podspecs.git @ dc0adce02cba98e28dee2312c03bf507235d7a00

Installation Source

Executable Path: /Users/dan/.rbenv/versions/2.4.2/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.0
cocoapods-try         : 1.1.0

Podfile

# vim: ft=ruby
#
platform :ios, '10.3'

source 'https://github.com/CocoaPods/Specs.git'
project 'My App.xcodeproj'

inhibit_all_warnings!
use_frameworks!

pod 'Alamofire', '~> 4.0'
pod 'AlamofireImage', '~> 3.0'
pod 'AlamofireNetworkActivityIndicator', '~> 2.0'

pod 'LionheartExtensions', '~> 3.8'
pod 'SuperLayout', '~> 0.2'
pod 'LionheartAlamofireClient', '~> 2.2'
pod 'QuickTableView', '~> 2.3'

pod 'TableViewPopoverPresenting', '~> 3'
pod 'FMDB/standalone/FTS', '~> 2.6'
pod 'KeyboardAdjuster'
pod 'ReachabilitySwift', '~> 3.0'
pod 'SwiftyUserDefaults', '~> 3.0'

pod 'Siren', '~> 1.1'

# Analytics
pod 'Mixpanel-swift', '~> 2.1'

pod 'Firebase/Core'
pod 'Firebase/Crash'
pod 'Firebase/Messaging'

pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'

pod 'ZendeskSDK'

pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :subspecs => ['Core', 'KSCrash'], :tag => '3.2.1'

target 'My App' do
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = "YES"
    end
  end
end

Most helpful comment

I had this error too, using XCode 11.3.1. What was causing the issue is that SWIFT_VERSION was only defined for the Debug mode. In Xcode, check that in Build settings > User-defined > SWIFT_VERSION both Debug and Release modes have a value, like this:

Capture d鈥檈虂cran 2020-08-03 a虁 17 59 20

All 5 comments

FWIW, I've gone through the entire project file, and SWIFT_VERSION is set to "4.0" for all targets.

Uh, I am uncertain what is going on here. I still believe your .xcodeproj for some reason includes SWIFT_VERSION for My App.

My advice is to open MyApp.xcodeproj/project.pbxproj and search for SWIFT_VERSION and delete the one with an empty value.

Going to close this and re-open if you can confirm there is no such entry in your project and upload a sample app demonstrating this issue.

@dnkoutso See my previous comment, it addresses your suggestion. Every target is set to "4.0"鈥攖here are no blanks.

Let me see if I can set up a sample project.

Thank you! Interesting to see you are also on Xcode 9.2 so that might have something to do with it.

I had this error too, using XCode 11.3.1. What was causing the issue is that SWIFT_VERSION was only defined for the Debug mode. In Xcode, check that in Build settings > User-defined > SWIFT_VERSION both Debug and Release modes have a value, like this:

Capture d鈥檈虂cran 2020-08-03 a虁 17 59 20

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luhui picture luhui  路  3Comments

tlandsmancars picture tlandsmancars  路  3Comments

sonu5 picture sonu5  路  3Comments

soleares picture soleares  路  3Comments

steffendsommer picture steffendsommer  路  3Comments