21

I am updating my project to Swift 3. When updating some of my cocoapods to swift 3, I receive the following message in terminal, after running pod install:

 Analyzing dependencies
[!] The following pods are integrated into targets that do not have the same Swift version:

- AWSCore required by myApp (Swift 3.0.1), myApptests (Swift 3.0)
- AWSS3 required by myApp (Swift 3.0.1), myApptests (Swift 3.0)
- Alamofire required by myApp (Swift 3.0.1), myApptests (Swift 3.0)

There is a lengthy thread here: https://github.com/CocoaPods/CocoaPods/issues/5864 about the issue, and I tried the proposed solution, but when I run pod install, i still get the same message.

Here is my pod file:

enter image description here

outside the one given link i haven't found much on this issue. Anyone else experienced the same problem? Any solutions? I just installed Xcode 8.1 and Swift 3.0.1 last weekend.

David R
  • 14,711
  • 7
  • 54
  • 72
jjjjjjjj
  • 4,203
  • 11
  • 53
  • 72

6 Answers6

41

I just solved a recent issue when I updated my swift3 project to swift4 one with Xcode9, the problem said: [!] The following pods are integrated into targets that do not have the same Swift version:

Appsee required by MyApp (Swift 4.0), MyAppUnitTest (Swift 3.0) ...Allpods

My solution was: With my main target MyApp with the swift version at 4.0, I also updated my UnitTest version to 4.0 into Build Settings --> Swift Language Version

DariusV
  • 2,645
  • 16
  • 21
6

This problem gets worse with Xcode 9 since it supports both 3.2 and 4.0 swift versions, but Cocoa Pods doesn't support this yet:

[!] The following pods are integrated into targets that do not have the same Swift version:
- XCGLogger required by target1 (Swift 4.0), target2 (Swift 3.0)

Workaround: switch target1 to swift 3.2 temporarily, install cocoa pods, then switch it back to swift 4.0.

Alexander Vasenin
  • 11,437
  • 4
  • 42
  • 70
  • do you have a source for CocoaPods not supporting this yet? or this is an assumption based on the error description? – George Marmaridis Oct 04 '17 at 13:10
  • @GeorgeMarmaridis I'm not sure if I understand your question right, but in this particular project I do have targets with different Swift versions and it seems like Cocoa Pods can't deal with it as is even though Xcode does – Alexander Vasenin Oct 04 '17 at 15:12
5

I have solved the problem like this:

  1. I had two targets: the main project and the tests targets.
  2. My main project's target had the 'Use legacy Swift Language version' (in Build Settings) to 'Unspecified (3.0)'.
  3. I set the 'Use legacy Swift Language version' to 'No' and it worked fine.
vbgd
  • 1,937
  • 1
  • 13
  • 18
  • 2
    Where is this option? I don't see it in build settings (xcode 8.3.3) – Adam Jul 12 '17 at 19:10
  • Looked for "Swift Language version" in build settings and made sure they were all the same. So this helped me get there – Nate Uni Dec 09 '18 at 02:32
4

When I opened my xcodeproj file it displayed 3.2, but when I ran git diff, I noticed that the project.pbxproj had everything as Swift 3.0.

Manually updating the SWIFT_VERSION variables to 3.2 with a text editor solved the discrepancy.

I recommend this as a last resort only!

RndmTsk
  • 1,704
  • 2
  • 12
  • 12
1

For CocoaPods App v.1.1.1 this problem was solved by setting Use legacy Swift Language Version to Unspecified in Build Settings section for all targets.

Probably it's an app bug - all targets had the same settings but CocoaPods app complaining only about one of them.

UPD: to be able to compile project I had to change it back from Unspecified to No

slxl
  • 635
  • 1
  • 10
  • 23
1

I had the problem with one target with a difference from 3.0 to 3.0.1

I solved it by manually editing the project file (project.pbxproj) and change 3.0; with 3.0.1;

Morten Holmgaard
  • 7,484
  • 8
  • 63
  • 85