xcode 以下 pod 被集成到不具有相同 Swift 版本的目标中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40471683/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
following pods are integrated into targets that do not have the same Swift version
提问by joey
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:
我正在将我的项目更新到 Swift 3。将我的一些 cocoapods 更新到 Swift 3 时,我在运行 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/5864about the issue, and I tried the proposed solution, but when I run pod install, i still get the same message.
这里有一个很长的线程:https: //github.com/CocoaPods/CocoaPods/issues/5864关于这个问题,我尝试了建议的解决方案,但是当我运行 pod install 时,我仍然收到相同的消息。
Here is my pod file:
这是我的 pod 文件:
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.
在一个给定的链接之外,我在这个问题上没有找到太多。其他人遇到过同样的问题吗?任何解决方案?我上周末刚刚安装了 Xcode 8.1 和 Swift 3.0.1。
回答by DariusV
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:
当我使用 Xcode9 将我的 swift3 项目更新为 swift4 one 时,我刚刚解决了一个最近的问题,问题是:
[!] 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
Appsee required by MyApp (Swift 4.0), MyAppUnitTest (Swift 3.0)
...全豆荚
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
我的解决方案是:我的主要目标MyApp
是 4.0 的 swift 版本,我还将我的 UnitTest 版本更新为 4.0 到Build Settings
-->Swift Language Version
回答by vladiulianbogdan
I have solved the problem like this:
我已经解决了这样的问题:
- I had two targets: the main project and the tests targets.
- My main project's target had the 'Use legacy Swift Language version' (in Build Settings) to 'Unspecified (3.0)'.
- I set the 'Use legacy Swift Language version' to 'No' and it worked fine.
- 我有两个目标:主项目和测试目标。
- 我的主要项目的目标有“使用旧版 Swift 语言版本”(在构建设置中)到“未指定(3.0)”。
- 我将“使用旧版 Swift 语言版本”设置为“否”,效果很好。
回答by Alexander Vasenin
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:
这个问题变得更糟,Xcode 9
因为它同时支持 3.2 和 4.0 swift 版本,但是 Cocoa Pods 还不支持这个:
[!] 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.
解决方法:暂时将 target1 切换到 swift 3.2,安装可可豆荚,然后将其切换回 swift 4.0。
回答by RndmTsk
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.
当我打开我的xcodeproj
文件时,它显示出来3.2
,但是当我运行时git diff
,我注意到它与project.pbxproj
Swift 3.0 一样。
Manually updating the SWIFT_VERSION
variables to 3.2
with a text editor solved the discrepancy.
使用文本编辑器手动更新SWIFT_VERSION
变量3.2
解决了差异。
I recommend this as a last resort only!
我只推荐这作为最后的手段!
回答by slxl
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.
对于 CocoaPods App v.1.1.1,这个问题是通过将所有目标设置Use legacy Swift Language Version
为Unspecified
inBuild Settings
部分来解决的。
Probably it's an app bug - all targets had the same settings but CocoaPods app complaining only about one of them.
可能这是一个应用程序错误 - 所有目标都具有相同的设置,但 CocoaPods 应用程序只抱怨其中一个。
UPD: to be able to compile project I had to change it back from Unspecified
to No
UPD:要能编制项目,我不得不从后改Unspecified
以No
回答by Morten Holmgaard
I had the problem with one target with a difference from 3.0 to 3.0.1
我有一个目标的问题,从 3.0 到 3.0.1 的差异
I solved it by manually editing the project file (project.pbxproj) and change 3.0; with 3.0.1;
我通过手动编辑项目文件(project.pbxproj)并更改3.0解决了它;与 3.0.1;