简体   繁体   中英

Swift project with Cocoapods dependencies

I have the following 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. 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:

 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):

$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. 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 .

Have I missed anything here (regarding the SwiftyJSON version mismatch) ? I've tried cleaning the project, redoing pod install, etc without any luck..

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 )
  2. pod install to wipe them out
  3. Upgrade (or downgrade if you're on 0.38.1) to cocoapods 0.38.0
  4. Add pods back & pod install

Now I'm back in business... I believe 0.38.1 was responsible for getting me into this mess.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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