How do I add a private pod as a dependency in my podspec? - cocoapods

I have a PodA which has a dependency on PodB. I made both PodA and PodB myself and I pushed them to two separate repos, and also their podspecs into a single shared podspec repo.
In the podspec for PodB, I want to add PodA as a dependency, so I included the following line in PodB's podspec file:
spec.dependency 'PodA', '~> 0.1.0'
I also include the source in PodB's pod file and also add is as a dependency:
source 'git#gitlab.com:PodASourceHere.git'
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'PodB' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for PodB
pod 'PodA', '~> 0.1.0'
end
However when I run pod lib lint on PodB I get the following error:
ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for `PodA (~> 0.1.0)` depended upon by `PodB`
I read about another command "pod repo push", is this necessary for cocoapods to detect the actual pod name "PodA" in PodB's podspec? Will this expose PodA to the public for use? Is this the only way to include private pods as dependencies?

Related

Cocoapods installs pods not specified in projects Podfile

When I run pod install cocoapods installs several pods not listed in the current projects Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'PodUser' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for PodUser
pod "PodTest"
end
My pod install output:
pod install
Analyzing dependencies
Downloading dependencies
Using AFNetworking (3.1.0)
Using FirebaseAnalytics (3.9.0)
Using FirebaseCore (3.6.0)
Using FirebaseInstanceID (1.0.10)
Using Google (3.1.0)
Using GoogleAnalytics (3.17.0)
Using GoogleToolboxForMac (2.1.1)
Using PodTest (0.0.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 8 total pods installed.
CocoaPods installs the specified pods and all of those pods' dependencies.
If you look at PodTest.podspec and its dependencies and recursively follow the podspec's for those dependencies, it should match the pods that get installed.
See also the file Podfile.lock that gets created alongside the Podfile to see a list of the relevant pods and their dependencies.

Unable to satisfy requirements when specifying version in podfile

I'm using the Cocoapods app. When trying to install the current Alamofire, I get the following error:
Analyzing dependencies
[!] Unable to satisfy the following requirements:
- `Alamofire (~> 4.4)` required by `Podfile`
None of your spec sources contain a spec satisfying the dependency: `Alamofire (~> 4.4)`.
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
This is my podfile:
project 'MyApp.xcodeproj'
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Alamofire', '~> 4.4'
end
If I remove the version and just use pod 'Alamofire', it installs version 4.0.1. Why?
The issue is as per the last line of the log.
You need to run pod repo update
There appears to be an option in the app in the menu Specs Repos that has an update button for me. However this does not seem to work.
Running the command line then allowed mre to run Build->Install from the Cocoapods app
This might be happening due to the cocoa pod version required by the new almofire version is higher than what u have installed in your system. Please check version of ypu pod by pod --version in command line , if it is less than 1.0 update pod spec , you can find the steps here .https://guides.cocoapods.org/using/getting-started.html
Your new pod will be installed. Also the when u don not specify a version in your pod file than cocoa pods itself selects the latest version it supports and install it .Thats why your almofire was getting updated to 4.0.1.,Hope this helps you.

How i can update my cocoa repo?

Im trying to use the version > 1.24 of Lock (https://github.com/auth0/Lock.iOS-OSX), but my cocoa repo has not available this version. I execute pod search Lock and i see the follow info:
Lock (1.13.0)
A library that uses Auth0 for Authentication with Native Look & Feel
pod 'Lock', '~> 1.13.0'
- Homepage: https://github.com/auth0/Lock.iOS-OSX
- Source: https://github.com/auth0/Lock.iOS-OSX.git
- Versions: 1.13.0, 1.12.1, 1.12.0, 1.11.3, 1.11.2, 1.11.1
The version in the repo is 1.27, and my repo is old. I try to update using pod repo update but still unavailable
¿Someone can help me?
Im trying to use this podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
target 'TalkClassTest' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for TalkClassTest
target 'TalkClassTestTests' do
inherit! :search_paths
pod 'Lock', '~> 1.24'
end
end
but when i execute pod install i obtain this erros:
[!] Unable to satisfy the following requirements:
- `Lock (~> 1.24)` required by `Podfile`
None of your spec sources contain a spec satisfying the dependency: `Lock (~> 1.24)`.
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.
MacBook-Air-de-Randall:TalkClassTest Randal$
thank to everyone, the solution applied is execute the follow commands: pod repo remove master and after pod setup

Cannot install Alamofire 4.0 in Xcode 8.0 Using CocoaPods

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 :)

How to fix error with CocoaPods?

I'm learning iOS just now.
I cloned from https://github.com/huyouare/SwiftParseChat.git
and I build it but get error.
diff: /../Podfile.lock: No such file or directory
diff: Manifest.lock: No such file or directory error:
The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.`
So I remove the workspace file and pod install.
rm -rf MyProject.xcworkspace
pod install
But I met errors.
Re-creating CocoaPods due to major version update.
Analyzing dependencies
[!] The dependency `Alamofire (~> 1.3)` is not used in any concrete target.
The dependency `APAddressBook` is not used in any concrete target.
The dependency `Bolts` is not used in any concrete target.
The dependency `JSQMessagesViewController (from `https://github.com/galambalazs/JSQMessagesViewController.git`, branch `smooth-scrolling`)` is not used in any concrete target.
The dependency `JSQSystemSoundPlayer` is not used in any concrete target.
The dependency `FBSDKCoreKit` is not used in any concrete target.
The dependency `FBSDKLoginKit` is not used in any concrete target.
The dependency `FBSDKShareKit` is not used in any concrete target.
The dependency `FBAudienceNetwork` is not used in any concrete target.
The dependency `Parse` is not used in any concrete target.
The dependency `ParseUI` is not used in any concrete target.
The dependency `ParseCrashReporting` is not used in any concrete target.
The dependency `ParseFacebookUtils` is not used in any concrete target.
[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
The Podfile is :
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ‘8.0’
use_frameworks!
pod 'Alamofire', '~> 1.3’
pod 'APAddressBook'
pod 'Bolts'
pod 'JSQMessagesViewController', :git => 'https://github.com/galambalazs/JSQMessagesViewController.git', :branch => 'smooth-scrolling'
pod 'JSQSystemSoundPlayer'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'FBAudienceNetwork'
pod 'Parse'
pod 'ParseUI'
pod 'ParseCrashReporting'
pod 'ParseFacebookUtils'
How can I fix this error?
You can modify the podfile like this:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'SwiftParseChat' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Alamofire', '~> 1.3’
pod 'APAddressBook'
pod 'Bolts'
pod 'JSQMessagesViewController', :git => 'https://github.com/galambalazs/JSQMessagesViewController.git', :branch => 'smooth-scrolling'
pod 'JSQSystemSoundPlayer'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'FBAudienceNetwork'
pod 'Parse'
pod 'ParseUI'
pod 'ParseCrashReporting'
pod 'ParseFacebookUtils'
# Pods for SwiftParseChat
end
Try like this
rm Podfile
pod init
Then new Podfile is created.
Then you can insert necessary API to the new Podfile.

Resources