In my project I'm using both Swinject and SwinjectAutoregistration pods. Both are usually declared as '2.0.0' versions like so:
pod 'Swinject', '2.0.0'
pod 'SwinjectAutoregistration', '2.0.0'
But in order to build my project in the beta version of Xcode 9, I need to take a specific branch of the Swinject github repo, as stated here. The new declaration looks like this:
pod 'Swinject', :git => 'https://github.com/Swinject/Swinject.git', :branch => 'swift4'
When I then try pod update I have dependencies error. I believe SwinjectAutoregistration declares a dependency to Swinject 2.0 so I have different sources for the same pod.
Is there a way to tell cocoapods that this specific source of the pods acts like the 2.0 version?
Well, it seems like specifying the source as the github repo instead of the cocoapod repo for this particular pod works.
I added this line before the target 'MyGreatApp' do line:
source 'https://github.com/Swinject/Swinject.git'
I must specify that this works for this particular pod, but might not work for other cases. The fine folks behind Swinject have a fix for an Xcode (9, beta) bug on a branch in their github repo that is not in the cocoapod repo.
So this answer works in this case, but unfortunately this might not be as generic as I hoped.
Related
I'd like to specify version 5.1.0 of the InstaCart TrueTime library in a Podfile instead of 5.0.3. I think this is the only way to use 5.1.0 since 5.0.3 hasn't been added to the master per https://github.com/instacart/TrueTime.swift/issues/97
(The library is pretty outdated unfortunately.)
According to Add Pod dependency with source to .podspec, the way to do this is add
source 'https://github.com/instacart/TrueTime.swift.git'
at the top, but I then get the following error with 'pod update':
[!] Unable to find a specification for `TrueTime`
I think this error occurs because the source has TrueTime.podspec at the top level instead of inside a '5.1.0' folder, even though my podspec doesn't specify a version:
s.dependency "TrueTime"
Is my thinking correct, and is there a way to solve this issue?
The source attribute is used to refer to a podspec repository, not a single pod.
To accomplish that goal, you could set up a private specs repository and publish the desired podspec there - then refer to the podspec repo from the Podfile.
Details at https://guides.cocoapods.org/making/private-cocoapods.html
I am trying to add this github project to my project as a pod: https://github.com/matsune/MidiParser
In my PodFile, I have tried
pod 'MidiParser'
and
pod 'MidiParser', :git => 'https://github.com/matsune/MidiParser.git'
but either time I get the error
Unable to find a specification for 'MidiParser'.
I have tried adding other pods like 'https://github.com/daltoniam/SwiftHTTP' just to see if they work, and they do. I notice there are multiple projects on GitHub called MidiParser, so maybe I need to distinguish between them somehow? The installation instructions in the MidiParser README only give instructions for Carthage. It says to add this line to the Cartfile:
github "matsune/MidiParser"
I also have also tried:
pod 'matsune/MidiParser'
I notice I can't find the project when I search for it here: https://cocoapods.org.
Does that mean I simply can't install the project using Cocoapods, and that I have to do it manually?
Edit: I ended up using Carthage.
CocoaPods requires pods to be specified with a podspec to describe its Xcode workspace integration. See https://guides.cocoapods.org/making/making-a-cocoapod.html
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.
I have integrated Grabkit in my project via adding submodules. I want to add grabkit via cocoa pods. I surfed web alot. I have created a pod file.
pod 'Grabkit', :git => 'https://github.com/pierrotsmnrd/grabKit.git'
I have downloaded latest podspec file from https://github.com/CocoaPods/Specs/blob/05def154728953519546ee0c648a82f293d02f4f/grabKit/1.4/grabKit.podspec
When I run pod install or pod update I get following error:
$ pod update
Analyzing dependencies
CocoaPods 0.29.0 is available.
Pre-downloading: `Grabkit` from `https://github.com/pierrotsmnrd/grabKit.git`
[!] No podspec found for `Grabkit` in /path-of-my-project/Pods/Grabkit/Grabkit.podspec
Please suggest !!
I'm not sure why you'd want to download the latest podspec. The specs are automatically managed by the pod command line tool and there is a clone of the entire specs repo in ~/.cocoapods. The issue here is the case. It is grabKit notice the lowercase 'g'
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).