I think a question need not be described. Usually when I do pod install it updates for me all my libraries. How can I add one new and just add this new one without update other?
>pod install --no-repo-update
This installs new pods without updating existing pods.
It's also just faster if you have a many of pods and want a fast install of a new pod.
This isn't the expected behavior of pod install. The only way I can see this happening is if you're not using the Podfile.lock as intended. When you specify something in your Podfile that you have never installed before, for example:
pod 'MyAwesomeLibrary', '~> 1.0.1'
The newest version matching your specification is determined (explained here) and the resolved version is stored in the Podfile.lock. In this case that could mean that you actually download 1.0.4 etc.
This means when you go to add another library, for example:
pod 'AnotherAwesomeLibrary', '~> 2.0.1'
The same thing will happen for the new one. But, because of the information previously stored in your Podfile.lock, CocoaPods will just verify that the version specified there is installed. It will not update that library. If you actually want to update it you'll need to run pod update
pod install --no-repo-update
thats it
Related
I have created a new iOS framework in which I listed external cocoapods as dependancies in my podspec file.
I successfully ran podspec lint without warnings/errors and then pushed the trunk which was also successful.
I read in several places that it usually takes up to an hour to show up so after 2 hours I tried to integrate the pod into a demo project using pod install, it gave me some errors like:
This pod might no longer be available
There could be an issue with the repository link
The name of the pod might be invalid
All of which I disagree to. So upon further research, I saw some people even had to wait for 7 hours as they had quite a heavy project, however, my library is not too heavy and it's dependancies are quite heavy but since they are not included in the project itself, I was wondering why it took so long.
Then I came across another pod install command pod install --repo-update which I ran seconds after pod install failed and it installed my pod and all of it's dependancies.
So I am curious to know what is the difference between these commands and how come one worked and the other did not ?
Thanks
pod install --repo-update and pod update update your local copy of the centralized CocoaPods Specs repository with the latest version.
pod install will use the previous local copy on your machine.
If a pod publisher published a new version after the last time you updated your local copy, pod install won't have access it to it. That's why you need to specify --repo-update.
I want to remove specific dependency using cocoapods. if I execute pod install, other dependencies are getting updated before removing the dependency I want to delete. I just want to remove specific pod without touching any others. And I know deleting, updating any dependency also updates others. Is there any way to solve this problem?
Actually my problem is when I modify some dependency (AFNetworking for example) and run pod install it reverts back to its original version. But I don't want to lose my changes.
Remove specific pod from podfile and run below command in terminal:
pod install --no-repo-update
pictorial representation with steps detailed.
I had to do some local changes to some frameworks I am using. However, I installed them with cocoapods. Is there any way to keep those changes when I do pod install again for new dependencies ?
Thanks for the ask question.
I am sorry to say this is not possible because when you have install or Update your pod then replace all file from new file.
pod outdated:
When you run pod outdated, CocoaPods will list all pods which have newer versions than the ones listed in the Podfile.lock (the versions currently installed for each pod). This means that if you run pod update PODNAME on those pods, they will be updated — as long as the new version still matches the restrictions like pod 'MyPod', '~>x.y' set in your Podfile.
pod update:
When you run pod update PODNAME, CocoaPods will try to find an updated version of the pod PODNAME, without taking into account the version listed in Podfile.lock. It will update the pod to the latest version possible (as long as it matches the version restrictions in your Podfile).
If you run pod update with no pod name, CocoaPods will update every pod listed in your Podfile to the latest version possible.
You can also find reference from here.
You have to create a folk on git, of that libraries in which you are doing changes localy, and use that commit url instead of library name and version in pod file.
Whenever you are going to update lib, you will get your code.
This is solve your problem. :)
I have some doubt on CocoaPods
I think the 1st rule is that keep Podfile and ignore pods folder entirely. But I am so confused about this after I have used some time
Since I insist on #1, somebody says *.lock should be kept in repo. Do I need do this?
Pods generates some xconfig files, it seem I can't add HEADER_SEARCH_PATH in it ?
if YES, it breaks my rule #1 again. Please see this question the-target-overrides-the-other-ldflags-build-setting-defined-in-pods-pods
some buddies modify codes managed by CocoaPods such as AFNetworking rather than from custom repo. I told him NEVER do this because it will recover to origin version after pod update/install but after pod update/install his code didn't change. that's WHY?
My opinion is DON'T MODIFY EVERTHING IN PODS PROJECT EXCEPT PODFILE
You should always check in your Podfile and Podfile.lock.
Checking in your Pods directory is debatable. If you would like to be able to clone the project and run it without requiring users to have CocoaPods you should check this in. I personally do not check this directory in, instead you just have to run pod install after cloning the project for the first time.
If you want to alter the xcconfig files with changes such as HEADER_SEARCH_PATH you should check this in so those settings don't get overwritten unintentionally. Really the podspec should handle all of these settings so you probably shouldn't be changing much in there.
If you're planning on altering the code included by a Pod you should either check in your Pods folder or fork the repo and redirect it to in your Podfile. Documentation on that here. This way you can specify that CocoaPods uses the given spec but uses your fork instead.
EDIT The Podfile.lock (similar to the Gemfile.lock) stores information on the actual version included during the install. Consider this:
You require a spec like pod 'foo', '~> 1.0.0 in your Podfile.
You run pod install and it installs the newest version of foo matching the semantic versioning conventions (specified by ~>)
You don't check in your Podfile.lock
Another developer clones the repo, the newest version of foo is now 1.0.3.
They run pod install. Version 1.0.3 is installed even though they didn't run pod update.
This information is 'locked' in the Podfile.lock so that to do this you have to run pod update which should be very intentional.
I use Cocoapods. I have made some changes to a 3rd party library and if I run pod update, all those changes would get replaced. Running pod install does the same thing.
Is there a way to exclude a pod from updating? Or a way to install a single pod without affecting others?
At last Found the Solution.
It will install pod without any repository update if you already have the library in the project,else will download
pod install --no-repo-update
If you want to update specific libraries you can use :
pod update [POD_NAME...]
I know this topic is pretty old but someone might come here after an answer, so here it is:
from https://github.com/CocoaPods/CocoaPods/pull/7524
--exclude-pods option to pod update command.
It allows to skip the update operation for specific pods.
Yes, just specify the version you want to install, like if you want to keep using AFNetworking 1.3 and not upgrade to 2.*:
pod 'AFNetworking', '~> 1.3.2'
Please check this discussion:
https://github.com/CocoaPods/CocoaPods/issues/760
One possible solution for now to update only a single pod would be:
Remove specific pod from Podfile
pod install
Re-add specific pod to Podfile
pod install