Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using two versions of a Cocoapod dependency

So I'm trying to get with the times and use some of the new features offered in AFNetworking 2.0. However, I am also using RestKit 0.20 which has AFNetworking 1.3 as a dependency? Am I allowed to incorporate AFNetworking 1.3 and 2.0 into my Xcode project or can I only pick one? Is there a CocoaPod trick for this?

https://github.com/AFNetworking/AFNetworking

https://github.com/RestKit/RestKit

like image 505
mosca1337 Avatar asked Nov 23 '13 04:11

mosca1337


People also ask

Can a swift package depend on a Cocoapod?

Unfortunately, swift-atomics doesn't support CocoaPods, so you'll need your own Podspec for it.

How do I update pod dependency?

$ pod updatelock . It will update the pod to the latest version possible (as long as it matches the version restrictions in your Podfile). If you run pod update without any pod name, CocoaPods will update every pod listed in your Podfile to the latest version possible.


2 Answers

CocoaPods does not (currently) do dependency resolution with multiple versions of the same library. I'm not sure about the technical difficulties surrounding this but I believe one way to think about why it would be a pain is duplicate symbol errors that we've all undoubtably seen before. Unless RestKit updates their AFNetworking integration, which would take some doing I'm sure for such a large library, you'll have to pick which one you need more.

like image 147
Keith Smiley Avatar answered Oct 14 '22 17:10

Keith Smiley


I wanted to mention that if you're using RestKit, this framework is meant to Abstract out you Networking operations, so if you project allows for it, it would be best not to use AFNetworking directly, and let restKit do the work instead. Being that said, I would also point out that you can use the dependency used by restKit (i.e 'AFNetworking', '~> 1.3.0'), and Just Use the previous API provided by AFNetworking, in case you really need to make direct use of this library. Hope it helps =)

like image 24
Robertibiris Avatar answered Oct 14 '22 17:10

Robertibiris