Accidentally ran pod update instead of pod install. Is there any way to revert?

我只是一个虾纸丫 提交于 2019-12-07 01:10:40

问题


I accidentally ran pod update instead of pod install, and now I have compile errors in my project.

Is there any easy way of reverting to my previous pods?

I'm thinking of hacking it -- I have my Podfile.lock file under source control, so I can grab the version numbers off that, then lock down the Podfile to those numbers e.g.:

pod 'AFNetworking', '2.6.3'

But is there a simple command like pod revert or pod undo or something?

Otherwise I'll probably just suck it up and update my project code to be compatible to the new pods.


回答1:


If you use git or other version control system, just reset changes in Podfile.lock and run $ pod install in terminal.




回答2:


You can go through the version changes in the pod install's output and rewrite your podfile with the desired versions.


For example:

In pod install output below, SwiftSpinner was updated from 0.9.5 to 1.0.2

Therefore, in the podfile change the line

pod 'SwiftSpinner'

to

pod 'SwiftSpinner', '0.9.5'

and run pod update again.


Now, you might get errors reverting certain pods:

[!] Unable to satisfy the following requirements:

- `Realm (= 1.0.2)` required by `Podfile`

- `Realm (= 1.1.0)` required by `Podfile.lock`

In such a case, close Xcode, delete your podfile and run pod install again.




回答3:


The best way is to remove the pods directory from your project and update and install it again.

rm -rf Pods 
bundle exec pod repo update
bundle exec pod install



回答4:


Remove the following files and folders:
- xcworkspace
- Podfile.lock
- Pods (Folder)

After, run:

$ pod install

This seems like something risky, but really it is not. I do it all the time



来源:https://stackoverflow.com/questions/38068944/accidentally-ran-pod-update-instead-of-pod-install-is-there-any-way-to-revert

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