source issue with podfile - cocoapods

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

Related

Can't add "MidiParser" pod to Podfile

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

Unable to find a specification for `React-Core` depended upon by `UMReactNativeAdapter`

Getting below error,
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Pre-downloading: `ExpoKit` from `http://github.com/expo/expo.git`, tag `ios/2.13.0`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
[!] Unable to find a specification for `React-Core` depended upon by `UMReactNativeAdapter`
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 tried,
pod setup
pod install
pod install --repo-update
Also, I uninstalled/installed cocoapods again, but still getting above error.
you can change your UMReactNativeAdapter podspec file,
s.dependency 'React-Core'
change '-' to '/'
check out this for similar issue.
https://github.com/joltup/rn-fetch-blob/issues/402#issuecomment-513077800
I got the same error for 'React-RCTFabric' as below.
Unable to find a specification for `React-RCTFabric` depended upon by `RNSVG`
I resolve this by enabling flag fabric_enabled in Podfile
:fabric_enabled => true,
Dependency React-Core is nothing more than the same React dependency being renamed by the developers.
You need to search for the version of UMReactNativeAdapter that list React as its dependency instead of React-Core
I got tired of getting the same error again and again
Basically, what needs to be done is add manually to your Podfile the pod missing
pod 'React-Core', :path => '../node_modules/react-native/React'
And probably you will need to add some more pods this way, here is useful list of possible missing pods:
https://github.com/facebook/react-native/issues/26310#issuecomment-534632566

Pod install installs pod from wrong spec repository

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.

How to satisfy cocoapod external dependancy when using specific branch

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.

Build xcconfig from podspec using exact version of dependency

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

Resources