简体   繁体   English

与Cocoapods依赖关系的Swift项目

[英]Swift project with Cocoapods dependencies

I have the following cocoapods Podfile 我有以下cocoapods Podfile

platform :ios, '8.0'

use_frameworks!

target 'Foo' do
        pod "SwiftyJSON", '~> 2.2.0'
        pod "Locksmith"
        pod "GoogleMaps"
        pod "RealmSwift"
end

target 'FooTests' do

end

I'm also using cocoapods 0.37.2. 我也在使用cocoapods 0.37.2。 For some reason, when I try to run the app, it complains with the following error, when clearly I have specified that my project requires SwiftyJSON 2.2.0 or greater: 出于某种原因,当我尝试运行应用程序时,它会抱怨以下错误,当我明确指出我的项目需要SwiftyJSON 2.2.0或更高版本时:

 Reason: Incompatible library version: Foo requires version 2.0.0 or later, but SwiftyJSON provides version 1.0.0

I have verified that there's no other dependencies on SwiftyJSON (using cocoapods-dependencies): 我已经验证了SwiftyJSON没有其他依赖关系(使用cocoapods-dependencies):

$pod dependencies

Dependencies
---
- GoogleMaps (1.10.1)
- Locksmith (1.2.2)
- Realm (0.93.2):
  - Realm/Headers (= 0.93.2)
- Realm/Headers (0.93.2)
- RealmSwift (0.93.2):
  - Realm (= 0.93.2)
- SwiftyJSON (2.2.0)

As you can see, no one is pulling SwiftyJSON 1.0.0. 如您所见,没有人会使用SwiftyJSON 1.0.0。 By the way, the reason I'm using cocoapods 0.37.2 is because of this bug when I tried to use 0.38.1: https://github.com/CocoaPods/CocoaPods/issues/3890 . 顺便说一句,我使用cocoapods 0.37.2的原因是因为我尝试使用0.38.1时出现这个错误: https//github.com/CocoaPods/CocoaPods/issues/3890

Have I missed anything here (regarding the SwiftyJSON version mismatch) ? 我在这里遗漏了什么(关于SwiftyJSON版本不匹配)? I've tried cleaning the project, redoing pod install, etc without any luck.. 我试过清理项目,重做pod安装等没有任何运气..

Thanks in advance! 提前致谢!

For me (and for you it seems), the following worked: 对我来说(似乎对你来说),以下工作:

  1. Remove guilty pods from podfile (in my case, AFNetworking and AFNetworkActivityLogger ) 从podfile中删除有罪的pod(在我的例子中, AFNetworkingAFNetworkActivityLogger
  2. pod install to wipe them out pod install将它们擦除
  3. Upgrade (or downgrade if you're on 0.38.1) to cocoapods 0.38.0 升级(或降级,如果你是0.38.1)到cocoapods 0.38.0
  4. Add pods back & pod install 添加pods和pod install

Now I'm back in business... I believe 0.38.1 was responsible for getting me into this mess. 现在我重新开始营业......我相信0.38.1是让我陷入困境的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM