问题
My new project using swift 4.2 has below podFile:
pod 'Moya', '12.0.1'
pod 'SwiftyJSON', '4.0'
pod 'Moya-SwiftyJSONMapper'
Intalling using pod install --verbose shows error:
[!] CocoaPods could not find compatible versions for pod "Moya": In Podfile: Moya (= 12.0.1)
Moya-SwiftyJSONMapper was resolved to 1.0.0, which depends on Moya-SwiftyJSONMapper/Core (= 1.0.0) was resolved to 1.0.0, which depends on Moya (~> 6.0.0) CocoaPods could not find compatible versions for pod "SwiftyJSON": In Podfile: Moya-SwiftyJSONMapper was resolved to 1.0.3, which depends on Moya-SwiftyJSONMapper/Core (= 1.0.3) was resolved to 1.0.3, which depends on SwiftyJSON (~> 2.3.2) SwiftyJSON (= 4.0)
回答1:
Your pod version are not compatible with each other, this Podfile
won't work.
But you can fix it.
But you have to check what podspecs of your pods to do this:
Moya-SwiftyJSONMapper: latest version of this pod is "3.0.0"
, and it depends on Moya
, version 10.x
and any version of SwiftyJSON
.
So your version 4.0
of SwiftyJSON
will be ok.
But you've specified that you want to install Moya
version 12.0.1
, which is not one of the 10.x
version, so it is incompatible.
So you have to get rid of version 12.0.1
requirement, to make it all work.
pod 'Moya', '~> 10.0'
or just
pod 'Moya'
And, I think it's better to have Podfile with no version specified before first pod install
. And only after auto-resolved combination of pods is installed you should freeze version requirements.
来源:https://stackoverflow.com/questions/53647891/cocoapods-could-not-find-compatible-versions-for-pod-moya