I have a project which uses CocoaPods. My Podfile specifies the dependencies required, however, I did not specify the versions that should be used.
I'd like add explicit dependency versions to my Podfile, so that using pod install after checking out my project on a new computer would always fetch my current, not newest version of Pod dependency from CocoaPods.
Is there a way to quickly check which version of each Pod dependency I currently have in my project directory?
The only way to update the currently installed versions of your pods is by running pod update. If you don't do this all the current version information is stored in the Podfile.lock and will make sure the versions are the same between installs.
This file is also the best place to look for these versions if you want to add them. In your Podfile.lock you'll see a list like this:
PODS:
- EasyMapping (0.6.3)
- Expecta (0.3.1)
- OCMock (3.1.1)
- OHHTTPStubs (3.1.6):
- OHHTTPStubs/Core
- OHHTTPStubs/Core (3.1.6)
- Specta (0.2.1)
The top level (left most) entries are the pods you have specified in your Podfile. As you can see to the right is the currently installed version. You can grab the versions from here and put them in your Podfile.
Related
We created a private pod called ListKit und put it into our private cocoapods repository.
The Cocoapod Documentation says:
"The order of the sources is relevant. CocoaPods will use the highest version of a Pod of the first source which includes the Pod (regardless whether other sources have a higher version)."
We included both spec sources on top of the Podfile like so:
(our own repo is the first on the list)
source 'ssh://git#stash.mycompany:7999/customspec.git'
source 'https://github.com/CocoaPods/Specs.git'
For some reason ListKit of the Cocoapods Master Spec Repository will be used if i run
pod install
instead of the ListKit from our private spec repository.
Is this intentional or a bug?
I use Cocoapods Version: 1.5.3
on Mac OS 10.13.2
See the doc at https://guides.cocoapods.org/syntax/podfile.html#pod. You can directly set an individual source for a specific pod to disambiguate this situation:
pod 'ListKit', :source => 'ssh://git#stash.mycompany:7999/customspec.git'
As for why it is originally fetching from the second repository instead of the first repository, it may be a bug, or it may be that another pod using the Master Spec Repository had a dependency on 'ListKit', or it may be that no pod matching the requirements of 'ListKit' could be found in the first repo.
My current project using cocoa pods of version 0.39.1, and my current pod version in my system is 1.1.1, so when i try to install the cocoa pods in my project path, it gave me warning saying
[!] Invalid Podfile file: [!] Unsupported options {:exclusive=>true} for target Xxx Xxx XxxxTests..
so i have uninstalled pod v1.1.1 and installed 0.39.1. Now when i run install command i get another warning
[!] The master repo requires CocoaPods 1.0.0 - (currently using 0.39.0) Update Cocoapods, or checkout the appropriate tag in the repo.
i'm aware that Xcode 8: Only works with CocoaPods 1.1.0
Should i update my project pod file to latest pod version or should i work with lower version of xcode so it supports v0.39.0
I recently completed a project where I had to migrate a dozen or so (private) Cocoapods from 0.39 up to 1.1.X.
It's actually not that hard, once you get the hang of it (and, at least in my case, the Podfile I put together for 1.1.X continued to work the occasional times I had to drop back down to Pods 0.39)
As you've discovered, you do need to remove ":exclusive => true" and "link_with" (which gets replaced with abstract_target). More information can be found in this Pods migration guide. Here is another "mini" example.
And other people have asked related questions here before. My recommendation is to go up to Xcode 8, otherwise you'll won't be able to do pod update and keep up to date with the latest changes in the Pods you're trying to leverage in your code.
Basically I did as instructed by the firebase.google.com website on how to set up. Everything sets up alright, until I tried to FIRApp.Configure() in the App Delegate. Received an error. Reinstall the Cocoapods to realize the version is 2.5.1 which I don't believe is the latest version. So how do I get the latest version is my question?
Note: Using Swift, pod search only shows 2.5.1 as latest.
Pod file:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
target 'OptionMeFood' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for OptionMeFood
pod 'Firebase'
end
Just put this in your Podfile without a version number, It should then load the latest version (3.2):
pod 'Firebase'
See here: https://firebase.google.com/docs/ios/setup#add_the_sdk
This will add the latest version of the Firebase pod, which include the /Core subspec. This provides Firebase Analytics. A list of currently available pods and subspecs is provided below. These are linked in feature specific setup guides as well.
The ParcelKit Cocoapods podspec file defines a dependency on the Dropbox Sync API SDK like so:
s.dependency 'Dropbox-Sync-API-SDK', '~> 3.1.0'
At the moment, this means it fetches version 3.1.1 of the SDK (it's ambivalent about the final part of the version number - which is a good thing!). But the same podspec also then adds an entry to the Framework search paths of the xcconfig file using a hardcoded version number, 3.1.0:
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"${PODS_ROOT}/Dropbox-Sync-API-SDK/dropbox-ios-sync-sdk-3.1.0"' }
This causes a compilation error, because it looks for v3.1.0 and ignores what is actually installed, v3.1.1, so it can't find the header files and everything breaks.
Obviously we can manually update the ParcelKit podspec (and indeed, it has already been updated to explicitly reference v3.1.1) but I wondered if there's a more robust way to define this so that if Dropbox ever releases v3.1.2 then the podspec continues to work automatically? i.e. that it will automatically add 3.1.2 to the Framework search paths rather than 3.1.0.
To specify a version like this remove the ~>.
s.dependency 'Foo', '3.1.0'
The different ways to specify a version are explained here
I haven't found the answer to this within the Podfile docs, so I'm not sure if it's possible.
I want to install a CocoaPods project which has 3 dependencies. I add it to my Podfile:
pod 'IDMPhotoBrowser'
and run install:
$ pod install
Installing DACircularProgress (2.1.0)
…
Installing IDMPhotoBrowser (1.2)
…
Installing SVProgressHUD (0.9)
However, I have a hacked up version of SVProgressHUD in my project which contains code not in the current repo. Additionally, SVProgressHUD 0.9 is from January, and there are months of additional commits since then. I would like to use my manually added version instead.
Can I specify in my Podfile that SVProgressHUD should not be installed, so that my manually added version is used? Or do I just need to delete it by hand every time I run pod install?
Alternatives
I know I could upload my fork to github and do something like:
pod 'SVProgressHUD', :git => '<my git repo>', :commit => '<my sha>'
but I'm hoping to not need to upload code just to get Cocoapods to do what I want.
It's not so much about blocking the dependency as it is overriding it with your own. This means that CocoaPods needs to find your local copy of SVProgressHUD before it activates IDMPhotoBrowser and looks for SVProgressHUD in the master spec repo.
You can achieve the setup you want by declaring your version of SVProgressHUD first in your Podfile using a local podspec:
Your custom version needs to be in a subdirectory of your project, with a valid podspec at the root of that directory, e.g., External/SVProgressHUD/SVProgressHUD.podspec.
Update your Podfile like this:
pod 'SVProgressHUD', :path => 'External/SVProgressHUD' # this needs to be declared first
pod 'IDMPhotoBrowser' # your custom pod will be used as the dependency here
If you don't have a local podspec, you should be able to take a copy of the 0.9 version of SVProgressHUD (and if necessary modify it to compile any new code you've added).