Cocoapods pod install gives undefined method inherit - cocoapods

I am getting this wierd error. If I look at the cocoapod specs, this seems like a valid syntax. What am I doing wrong.?
[!] Invalid `Podfile` file: undefined method `inherit!' for #<Pod::Podfile:0x007fad141d1050>. Updating CocoaPods might fix the issue.
# from /Users/Downloads/EarlGrey-master/Demo/EarlGreyExample/Podfile:28
# -------------------------------------------
# target TEST_TARGET do
> inherit! :search_paths
# pod 'EarlGrey'

Open your Podfile and Remove Project_Tests block.
for example,
Following Gives Error :
use_frameworks!
target 'MyPodProject_Example' do
pod 'MyPodProject', :path => '../'
target 'MyPodProject_Tests' do
inherit! :search_paths
end
end
Successful:
use_frameworks!
target 'MyPodProject_Example' do
pod 'MyPodProject', :path => '../'
end
Then do pod update (in terminal). This will create the .xcworkspace

Make sure you have the latest version of Cocoapods installed.
As mentioned by Zoidberg, you need to have at least version 1.0 (which is now stable) in order to support 'inherit'.
sudo gem install cocoapods
With this your pod install should not give you any errors.

I face a similar problem, here is what worked for me
sudo gem install cocoapods --pre
this will basically install the 1.0.0.beta.6 version of cocoapods which has 'inherit'

Related

error when installing a pod file Cocoapods version 1.9.1

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'

CocoaPods could not find compatible versions for pod "MatrixSDK"

I'm trying to build application from xcode.
I cloned the project from git repo.
I opened .xcodeproj file and from Product > Build I tried to build but build is failed.
From terminal I executed below commands and receiving compatible version error
I searched for solution and tried few ways like:
sudo gem intall cocoapods
sudo gem intall cocoapods --pre
pod setup
pod deintegrate
pod install
pod update
pod install --repo-update
Below is terminal output:
Analyzing dependencies
Pre-downloading: `BarcodeScanner` from `https://github.com/htothee/BarcodeScanner.git`
Pre-downloading: `MatrixKit` from `https://github.com/N-Pex/matrix-ios-kit.git`, branch `fix_apns_push`
Pre-downloading: `MatrixSDK` from `https://github.com/matrix-org/matrix-ios-sdk.git`, branch `develop`
Pre-downloading: `QRCode` from `https://github.com/brackendev/QRCode.git`
[!] CocoaPods could not find compatible versions for pod "MatrixSDK":
In Podfile:
MatrixKit (from `https://github.com/N-Pex/matrix-ios-kit.git`, branch `fix_apns_push`) was resolved to 0.10.1, which depends on
MatrixSDK (= 0.13.0)
MatrixSDK (from `https://github.com/matrix-org/matrix-ios-sdk.git`, branch `develop`)
Below is Podfile
platform :ios, '9.3'
use_frameworks!
def shared_pods
pod 'ProjectCore', :path => '../'
pod 'MatrixKit', :git => 'https://github.com/N-Pex/matrix-ios-kit.git', :branch => 'fix_apns_push'
pod 'MatrixSDK', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
end
target 'Project_Example' do
shared_pods
pod 'BarcodeScanner', :git => 'https://github.com/htothee/BarcodeScanner.git'
pod 'QRCode', :git => 'https://github.com/brackendev/QRCode.git'
pod 'Project', :path => '../'
target 'Project_Tests' do
inherit! :search_paths
end
end
target 'ShareExtension' do
shared_pods
pod 'ProjectExtension', :path => '../'
end
Expected:
.ipa file need to be created
Please let me know how can I solve it.
same problem for me
CocoaPods could not find compatible versions for pod "Branch"
remove Podfile.lock and Pods then do pod install
rm -rf ./Pods Podfile.lock
pod install --repo-update
try this, this worked for me. Thanks.
Your problem is explained in the error:
[!] CocoaPods could not find compatible versions for pod "MatrixSDK":
In Podfile:
MatrixKit (from https://github.com/N-Pex/matrix-ios-kit.git, branch fix_apns_push) was resolved to 0.10.1, which depends on
MatrixSDK (= 0.13.0)
The branch fix_apns_push of MatrixKit needs a fixed version of MatrixSDK, as you can see in its Podspec file
pod 'MatrixSDK', '0.13.0'
So, In order for your project to work, you need this version.
Try this:
def shared_pods
pod 'ProjectCore', :path => '../'
pod 'MatrixKit', :git => 'https://github.com/N-Pex/matrix-ios-kit.git', :branch => 'fix_apns_push'
pod 'MatrixSDK', '0.13.0'
end
insted of projectname.xcodeproj, please try to open projectname.xcworkspace.

Unable to find a specification for '[Any pod libraries]'

I don't know what's wrong with my cocoapods. It always show this error on every pod libraries every time I run pod install. For instance "AFNetworking"
[!] Unable to find a specification for `AFNetworking (~> 3.0)`
I tried the following but nothing help:
pod repo update
sudo rm -fr ~/.cocoapods/repos/master
pod setup
pod install
I tried to update my cocoapods to 1.1.1, Xcode to 8.2 and Mac OS to 10.12.2 but problem remain.
My cocoapods can't even search. It show this error every time I run "pod search AFNetworking"
[!] Unable to find a pod with name, author, summary, or description matching `AFNetworking`
Here is my podfile look like:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'Leader' do
use_frameworks!
pod 'AFNetworking', '~> 3.0'
end
I did try to uninstall and reinstall cocoapods back but nothing help.
Please follow below format in your pod file its working in project.
#Uncomment this line to define a global platform for your project
platform :ios, '8.0'
#Uncomment this line if you're using Swift
use_frameworks!
target 'applicationName' do
pod 'AFNetworking', '~> 3.0'
end
If you find any issue please let me know.

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

Why can't Travis-CI find my cocoapod dependencies?

This Podspec fails on the line pod 'SwiftyTimer', '~> 1.4' with Unable to find a specification for SwiftyTimer. It installs fine locally.
Things I've tried:
Specify the exact URL for SwiftyTimer (Still can't find it)
Manually integrate SwiftyTimer (it just fails on my next dependency, and I'd really like to not completely give up on the concept of dependencies)
My Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'CWNotificationBanner_Example' do
pod 'SwiftyTimer', '~> 1.4'
pod 'CWNotificationBanner', :path => '../'
target 'CWNotificationBanner_Tests' do
inherit! :search_paths
pod 'Quick', '~> 0.8'
pod 'Nimble', '~> 3.0'
pod 'FBSnapshotTestCase'
pod 'Nimble-Snapshots'
end
end
My travis.yml:
language: objective-c
podfile: Example/Podfile
before_install:
- rvm install ruby-2.2.2 #cocoapods 1.0.0 requirement not yet supported ootb by travis
- gem install cocoapods # Since Travis is not always on latest version
- pod install --project-directory=Example
script:
- set -o pipefail && xctool test -workspace Example/CWNotificationBanner.xcworkspace -scheme CWNotificationBanner-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
You might need to do a pod repo update to ensure that the Podspec is in the up-to-date repo.
The answer turned out to be: Specify an xcode version in the osx_image key in my .travis.yml:
language: objective-c
osx_image: xcode7.3
xcode_workspace: Example/CWNotificationBanner.xcworkspace
xcode_scheme: CWNotificationBanner-Example
xcode_sdk: iphonesimulator9.3
podfile: Example/Podfile
In my case it happened because of lack of pod specification on the CI machine. To fix it you need to add before_install in travis.yml file:
before_install:
- pod repo update

Resources