I've been using SwiftyJSON and Alamofire in a project. Recently I downloaded XCode 7 beta. Both SwiftyJSON and Alamofire have separate, non-master branches for Swift 2. Is there a way to get these via CocoaPods, or do I need to install them in the traditional way?
I tried searching on the CocoaPods website to see if these branches had been submitted as separate Pods, but nothing came up. I'm wondering if there is a Podfile syntax that allows you to get a non-master branch.
You can specify any branch from the repository in your Podfile.
Example I'm using for Alamofire:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift-2.0'
Change the line(s) in your Podfile then run pod install again.
There's also this alternative syntax:
pod 'Alamofire', git: 'https://github.com/Alamofire/Alamofire.git', branch: 'swift-2.0'
Update to the current answer. The line above now returns git errors complaining that the 'swift-2.0' branch is not found.
Use this form instead:
pod 'Alamofire', '~> 2.0'
Related
I've installed CDYelpFusionKit using CocoaPods, but I run into an error 65 since the package uses AlamoFireObjectMapper 5.2.0, which is incompatible with Swift 5. AlamoFireObjectMapper 5.2.1 has been released here https://github.com/tristanhimmelman/AlamofireObjectMapper/releases/tag/5.2.1, but it hasn't been released on CocoaPods. I'm trying to figure out how to replace the AlamoFireObjectMapper dependency that comes with the CDYelpFusionKit package with an updated branch from here https://github.com/RomanPodymov/AlamofireObjectMapper. I've tried the following in my podfile, then run pod repo update and pod install:
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/RomanPodymov/AlamofireObjectMapper.git'
platform :ios, '9.0'
target 'Demand' do
use_frameworks!
pod 'Google-Mobile-Ads-SDK'
pod 'CDYelpFusionKit', '~> 1.5.1'
pod 'AlamofireObjectMapper', :git => 'https://github.com/RomanPodymov/AlamofireObjectMapper.git', :branch => 'xcode-10-2-fix'
end
But I get the error:
"[!] CocoaPods could not find compatible versions for pod "AlamofireObjectMapper":
In Podfile:
AlamofireObjectMapper (from `https://github.com/RomanPodymov/AlamofireObjectMapper.git`, branch `xcode-10-2-fix`)
CDYelpFusionKit (= 1.5.1) was resolved to 1.5.1, which depends on AlamofireObjectMapper (= 5.2.0)"
1.) Update CocoaPods to its newest version
2.) Try to delete your lock file and run pod install after that, usually, it installs way newer versions of everything. Also, if your project is ios 9+, modify your platform to something bigger in yor podfile
I hope it is obvious but make a copy of your project folder before trying this solution if you are not using any version control or something along the line
Podfile Contents
platform :ios, '11.0'
target 'AVWXKit' do
use_frameworks!
pod 'AVWXKit'
end
Terminal Input: pod install
Error Message:
You have either:
* out-of-date source repos which you can update with `pod repo update`
or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
I have tried repo update to no avail. Any help appreciated
Using pod version 1.9.1
It seems that pod was never pushed to trunk: when I do pod search AVWXKit I get:
Unable to find a pod with name, author, summary, or description matching AVWXKit
To work around that, get the pod directly from its repo using:
pod 'AVWXKit', :git => 'https://github.com/JanC/AVWXKit'
I'm trying to follow this tutorial but i cant get cocoapods to work:
https://developers.google.com/identity/sign-in/ios/start-integrating
My pod file:
target 'GoogleSigninDemo' do
use_frameworks!
pod 'Google/SignIn'
end
I've only tried using cocoapods twice now and so far it has been pretty unpleasent. I have noticed that if i replace the pod 'Google/SignIn' with another pod it seems to work.
pod 'ChameleonFramework/Swift', :git => 'https://github.com/ViccAlexander/Chameleon.git'
for example.
Any thoughts?
There is no "/" in the pod name.
Try this instead :
pod 'GoogleSignIn', '~> 4.0'
Anyway, whenever you need to use CocoaPods, check out the CocoaPods page for the pod you are using : https://cocoapods.org/pods/GoogleSignIn
I need to upgrade one project to Swift 3.0, that has some libraries by Cocodpods.
So, I've removed all links related with Cocoapods and recreate pod file using pod init and upgrade some version of library such as AlamorFire.
But pod install said
[!] Unable to satisfy the following requirements:
- `Alamofire (~> 4.0)` required by `Podfile`
None of your spec sources contain a spec satisfying the dependency: `Alamofire (~> 4.0)`.
You have either:
* out-of-date source repos which you can update with `pod repo update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
I've updated deployment Target to 9.0 and using cocoapod 1.1.0
For test, I've created new project and added only Alamofire, but the result is same.
If you have some experience, please help me.
try sudo gem install cocoapods --pre
the pod file should look like
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'YourAPP' do
pod 'Alamofire', '~> 4.0'
pod 'SwiftyJSON', :git => 'https://github.com/acegreen/SwiftyJSON.git', :branch => 'swift3'
pod 'NetReachability'
end
Since you have an outdated pod repo, pod install getting failed. First of all you have to update your pod master repo before running pod install. Follow the steps given to update your pod repo and resolve the pod error.
Go to Cocoa Pods repo folder (~/.cocoapods/repos) and delete master folder
Run pod update on terminal. This will take several minutes to update pod repo.
When update get finished, run pod install (if required).
Hope this would be useful for those who are getting similar error :)
I am using CocoaPods for a macOS app. I have compilation errors with AFNetworking (current version, 1.2.1) and saw that these didn't exist in the previous version (1.2.0).
I did some research but did not find a possibility to define the version of a pod (for example, version 1.2.0 instead of 1.2.1).
Is this possible or do I have to wait until there is a new version of that library?
In your Podfile:
pod 'AFNetworking', '1.2.0'
Check 'Get started' at http://cocoapods.org
Once this is done, you can then issue a pod update in the terminal for the change to take place. Of course, this needs to be done from your project's top level folder. If the update does not occur, edit your Podfile.lock file and change the AFNetworking version # to something less than what it is and issue a pod update in the terminal again. This tells CocoaPods that you have a different version installed and that it must update.
Here, below mentions all possible ways to install pod with use cases.
To install the latest pod version, omit the version number after pod name.
pod 'Alamofire'
To install specific pod version, specify pod version after pod name.
pod 'Alamofire', '5.0.0'
Besides no version, or a specific one, it is also possible to use logical operators:
'> 0.1' Any version higher than 0.1
'>= 0.1' Version 0.1 and any higher version
'< 0.1' Any version lower than 0.1
'<= 0.1' Version 0.1 and any lower version
To install latest pod subversion of specified pod version :
pod 'Alamofire', '~> 0.1.2'
'~> 0.1.2' Version 0.1.2 and the versions up to 0.2, not including 0.2 and higher
'~> 0.1' Version 0.1 and the versions up to 1.0, not including 1.0 and higher
'~> 0' Version 0 and higher, this is basically the same as not having it.
To use pod from a local machine folder path:
pod 'Alamofire', :path => '~/Documents/Alamofire'
Install pods from the remote master branch
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'
Install pods from the remote specific branch
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'
Install pods from the specific tag on the remote branch
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.1.1'
Install pods from the specific commit on the remote branch
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :commit => '0f506b1c45'
To know more in details, check reference: Cocoa pods installation guideline
In your podfile, write :
pod 'podname', 'desired version'.
Close the Project
Run pod update or pod install (as applicable) to get the pods as mentioned in above step.
Compile the code with your desired pod version.
Use platform :ios, '8.0'. It will automatically install the previous one which will run on this platform