Cocoapods multiple library versions in same pod file - ios

Hello I have the follow pod file:
pod "AFNetworking", "~> 2.0"
pod 'RestKit', '~> 0.20.0'
And I have the error when try to pod install:
[!] Unable to satisfy the following requirements:
- `AFNetworking (~> 2.0)` required by `Podfile`
- `AFNetworking (= 1.1.0)` required by `RestKit/Network (0.20.0)`
- `RestKit/Network (= 0.20.0)` required by `RestKit/Core (0.20.0)`
RestKit require the versión 1.1.0 of AFNetworking but I want to work with 2.0 in my project how can I enable both?
I search in the documentation:
I found Version Conflicts in https://guides.cocoapods.org/using/the-podfile.html but this did not solve my problem.

Finally I think I will use the previous version of AFNetworking provided by RestKit as is suggested here, I hope in a future cocoapods could solve this problem.

Related

CocoaPods could not find compatible versions for pod “5.0.0-beta.1"

I want to use ‘Alamofire’, ‘~> 5.0.0-beta.1’via CocoaPods in my swift project.
I am getting the following error when after pod install in command line.
[!] CocoaPods could not find compatible versions for pod "Alamofire":
In Podfile:
Alamofire (= 5.0.0-beta.1)
AlamofireObjectMapper (= 6.0.0) was resolved to 6.0.0, which depends on
Alamofire (~> 5.0.0-beta.2)
Please help.
You can tried this the current stable version.
pod 'Alamofire', '~> 5.2'
But this version need Swift 5.1+
So you can use this version for Swift 4.2
pod 'Alamofire', '~> 4.7.3'

CocoaPods could not find compatible versions for pod "AFNetworking":

I would like to update my AFNetworking to version pod 'AFNetworking', '~> 4.0', but I am getting the following error.
[!] CocoaPods could not find compatible versions for pod "AFNetworking":
In Podfile:
AFNetworking (~> 4.0)
AFOAuth2Manager was resolved to 2.0.0, which depends on
AFNetworking (~> 2.2)
CocoaPods could not find compatible versions for pod "AFNetworking/NSURLConnection":
In Podfile:
AFOAuth2Manager was resolved to 2.2.0, which depends on
AFNetworking/NSURLConnection (~> 2.2)
None of your spec sources contain a spec satisfying the dependency: `AFNetworking/NSURLConnection (~> 2.2)`.
I am using pod version 1.8.4 and macOS 10.15.3 with xcode11.3.1.
Could you please help me on how to solve the issue
Had a similar problem, changing to
pod 'AFNetworking', '~> 4.0.1'
and removing an outdated dependency
# pod 'AFNetworking+RetryPolicy', '~>1.0.3'
was sufficient to solve this
I have fixed this issue with help from AFNetworking contributor
Please go through the following link
https://github.com/AFNetworking/AFNetworking/issues/4567#event-3368598218
I have updated my podfile like the follwing:
pod 'AFNetworking', :source => 'https://github.com/ElfSundae/CocoaPods-Specs.git'
pod 'AFOAuth2Manager','~> 3.0'

During Pod Installation `AFNetworking (~> 3.0)` is not used in any concrete target

Recently I've installed cocoapods v 1.0.0 in my mac successfully, I am trying to install 'AFNetworking', '~> 3.0' dependency in my pod file of my project directory. which I've created successfully, by putting following code in my pod file
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'AFNetworking', '~> 3.0'
but when I write pod install in terminal it giving me following error
[!] The dependency `AFNetworking (~> 3.0)` is not used in any concrete target.
could anyone suggest me why I am getting this error & how to resolve this issue?
After submitting this question, I further explored its solution & come to know at "https://guides.cocoapods.org/using/the-podfile.html" that I should write simply this code in my podefile
target 'MyApp' do
pod 'AFNetworking', '~> 3.0'
end
instead of above which I found at github AFNetworking official dependency installation guide. https://github.com/AFNetworking/AFNetworking
But I am curious about why the official AFNetworking method does not works for its installation in my project? could anyone answer it please?
anyway Thanks to cocoapods official website.

cocoa pods Dependency management

[!] Unable to satisfy the following requirements:
SDWebImage (= 3.7) required by DZNPhotoPickerController/Core (1.6.0)
AFNetworking (~> 3.0) required by Podfile
AFNetworking (~> 1.3.3) required by DZNPhotoPickerController (1.0.2)
PodFile
pod 'DZNPhotoPickerController'
pod 'ZXingObjC', '~> 3.0'
pod 'vfrReader','~>2.8.6'
pod 'Mantle'
pod 'PPSSignatureView'
pod 'AFNetworking','~>3.0'
pod 'JNKeychain'
pod 'SVProgressHUD'
pod 'ZipArchive'
I want to update AFNetworking.
Help me to solve this
To fix this you might need to
Fork the DZNPhotoPickerController repo and modify the dependency in
the Pod spec and then use your forked repo's git location in the pod
file. Not a great solution for the long term but works.
For instance, The Pod spec here should have the line#33 which is
ss.dependency 'AFNetworking'
should be changed to
ss.dependency 'AFNetworking', '~> 3.0'
in your forked repo.
Then use in your Pod file as below
pod 'DZNPhotoPickerController', :git => 'https://github.com/yourUsername/DZNPhotoPickerController.git'
Your forked repo is not guaranteed to work out of the box if the project relies on legacy dependency code, if any. In this particular case, if it uses any methods of AFNetworking that is removed in 3.0 it will not work.
To update a single AFNetworking pod,
pod update AFNetworking
with above code, cocoapods will find a latest updated pod version and update your pod.
To update your all pods you can use
pod update
this will update your all the pods.
The issue looks like 'DZNPhotoPickerController' has dependancy of ss.dependency 'AFNetworking', '~> 2.6.0' so when you are trying to update AFNetworking to version 3.0 it shows the wrong version error.
If you didn't check it recently the 'DZNPhotoPickerController' has also updated it's podspec to make AFNetworking to 3.0 so you should try pod update now it may fix your issue as both dependancy needs the same version
If the above and the fork 'DZNPhotoPickerController' in to newer one didn't work
Please remove the 'DZNPhotoPickerController' from the cocoapods
update the cocoapods by pod update
if it's successful add
the 'DZNPhotoPickerController' dependancy again in the cocoapods and
install that again it may solve your problem

Solutions for using different versions of a library with Cocoapods (specifically:IOSLinkedInAPI and RestKit)

I'm trying to use IOSLinkedInAPI and RestKit cocoa pods. Cocoa pod is installed and I have a the Podfile set up, and I'm trying to get both of these pods working together.
RestKit requires:
platform :ios, '5.0'
pod 'RestKit', '~> 0.23.1'
while IOSLinkedInAPI requires:
pod 'IOSLinkedInAPI', '~> 2.0.0'
when I do "pod install" I get an error saying:
[!] Unable to satisfy the following requirements:
- `AFNetworking (~> 1.3.0)` required by `RestKit/Network (0.23.1)`- `AFNetworking (>= 2.0.0)` required by `IOSLinkedInAPI (2.0.0)`
Have any of you encountered this before? What might you suggest?
This is not possible. Because of the way that C based languages work this would produce a duplicate symbol error. The library would have to update their dependencies.

Resources