Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cocoapods: An unexpected version directory was encountered. How do I fix this?

I am running CocoaPods to add a dependency to my project.

My pod file is located at Users/myUser/Desktop/project/project.

It looks like this:

source 'https://github.com/hackiftekhar/IQKeyboardManager.git'

pod 'IQKeyboardManager'

xcodeproj '../project.xcodeproj'

and it is named Podfile.

When I run pod install, I get this output:

Analyzing dependencies

[!] An unexpected version directory Categories was encountered for the /Users/myUser/.cocoapods/repos/hackiftekhar/IQKeyboardManager Pod in the IQKeyboardManager repository.

What is CocoaPods expecting here and how can I fix this?

Thanks,

C

like image 813
ChrisC Avatar asked Jan 29 '26 16:01

ChrisC


1 Answers

How to fix this is described in the Cocoapod repo, issue 6089.

Jest of it copied here in case link breaks in the future:

  1. Starting point

I try to create a private pod.

  • Environment: Xcode 8 Cocoapods 1.1.1

  • My Pods file tree:

looks like this

.
├── LICENSE
├── MoudlePod3
│   ├── 0.0.1
│   │   └── MoudlePod3.podspec
│   ├── TestObject3.h
│   └── TestObject3.m
├── MoudlePod3.podspec
└── README.md
  • run pod install

Everything is perfect!

  • Change creating the issue: Then I add some new folder and files to the pod Updated pods file tree:

. ├── LICENSE ├── MoudlePod3 │ ├── 0.0.1 │ │ └── MoudlePod3.podspec │ ├── 0.0.4 │ │ └── MoudlePod3.podspec │ ├── NewClass │ │ ├── TestObjectNew.h │ │ └── TestObjectNew.m │ ├── TestObject3.h │ └── TestObject3.m ├── MoudlePod3.podspec └── README.md

  • Increment podspec version to 0.0.4

  • Update client's podfile as follow: Demo Project Pod file:

    source 'https://github.com/CocoaPods/Specs.git' source 'http:///ljb/MoudlePod3.git'

    target 'MoudleApp' do pod 'MoudlePod3', '~> 0.0.4' end

  • run pod install

[!] An unexpected version directory NewClass was encountered for the /Users/apple/.cocoapods/repos/MoudlePod3/MoudlePod3 Pod in the MoudlePod3 repository.

  1. Explanation & solution from @benasher44 : Ah, so source 'http:///ljb/MoudlePod3.git' means that it expects that to be a specs repo, but it looks like you're trying to combine a specs repo and the repo where you keep the code for your pod, which is unsupported. You should instead remove the custom source line and do something like pod 'MoudlePod3', '~> 0.0.4', :git => ''. Checkout https://guides.cocoapods.org/using/the-podfile.html#from-a-podspec-in-the-root-of-a-library-repo for more info.

or in my case fix the source line to point to the private specs repo not the pod's source repo... Doh!

Hope that helps.

like image 84
Litome Avatar answered Jan 31 '26 07:01

Litome



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!