pod install failed with error: Library (from `../`)` required by `Podfile` when pod install in iOS

有些话、适合烂在心里 提交于 2019-12-03 09:12:52

问题


I am making a cocoapods. I am using pod lib create MyLibrary to create a new cocoapods. After it's done, I added two files into MyLibrary/Pod/Classes/. And I commit and add a tag and then push to origin master. and the MyLibrary.podspec passed validation. So, I go into the Example folder which created when I do pod lib create MyLibrary. and do a pod install in the terminal. But I am getting error:

Analyzing dependencies
Fetching podspec for `MyLibrary` from `../`
[!] Unable to satisfy the following requirements:

- `MyLibrary (from `../`)` required by `Podfile`

The podspec settings are all correct, like this one s.source_files = 'Pod/Classes/*.{h,m}', and it passed the validation. So I think there is no problem with pod spec file. It seems the pod installation can't find the Pod folder. But it is right there.

I am new to this making cocoapods. So if there is anything that not clear, please let me know. I don't know what I am doing wrong here.


回答1:


I had the same problem and I have been able to solve it following this steps:

  • Update cocoapod
  • Remove Podfile.lock
  • Installing again

Commands:

$> sudo gem install cocoapods --pre
$> rm Podfile.lock
$> pod install

Maybe some are not necessary, but it worked for me (I think that the most important is to remove the Podfile.lock). I hope you can solve it too.




回答2:


Yeah. One hour I've just paid to solve this problem. The problem was incompatibility of ios versions, a dependency had 7.0 but my target has 6.0 version. Updating to 7.0 the target version has solved my issue. Why wouldn't write an error message for such troubles?...




回答3:


try this:

$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ sudo rm -fr ~/.cocoapods/repos/master/

it works for me. I hope this solution will work for you too.




回答4:


I might be late, but if someone else finds this:

I often have the same problem, it happens when I use pod install in my own "MyLibrary" instead of pod update.

So try instead

pod update

This has to do something with your Podfile.lock, but I cant tell you exactly whats the reason.



来源:https://stackoverflow.com/questions/27633798/pod-install-failed-with-error-library-from-required-by-podfile-when

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!