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.
Related
I need to modify a flutter package which is made with swift.
So I forked the package, openend Xcode and started editing in Pods/Pods.
Basically I just have to change 2 variables in Constants.
But when I refernce my fork in my flutter packages the changes I made aren't there.
Can anyone help me with this? I am sure there is a way to modify the code.
Also run
flutter clean, removed Podfile.lock and Pods folder, run flutter pub get and pod install.
Thanks for any help!
Every modification in Pods is just temporary, when you install pods again, that change disappears, because it installs remote pods again.
You have to fork PusherSwift cocoapod and make changes there. And of course use your version in Podfile.
Update 1:
fork https://github.com/pusher/pusher-websocket-swift, because what I understand you want to modify file inside. (Constants.swift)
put pod 'PusherSwift', :git => 'urlToYourRepo.git', :branch => 'yourBranch' to podfile
Currently, in our company, we just commit all pods (like AFNetworking, Realm, etc) to svn/git. From time to time, when other developer install pod, update pod, there are conflict.
We also use this so that we don't touch other pods.
pod install --no-repo-update
Can I know what is the good practice for using third party pods? Do I need to commit those pods?
Or just do pod install again after our codes are checked out ? I just want to avoid code conflict for using pods.
You can refer to http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
Whether you check in or not, the Pods directory, the Podfile and Podfile.lock should always be kept under version control. It is recommended to keep it under version control and don't add it to your .gitignore
We also faced the same problem.As a solution, in commit we write only pod file with required pod list . Whenever other person take update, his podfile is updated and then from console he update his project pods.
As pod is same for all so you dont need to commit the pods. for more specific you can you can give pod with version.
Khant usually it's not a good practice to upload your dependencies to your repositories mostly because your will be saving space and time. it's ok to push your Podfile but all the code of your dependencies should be omitted and installed locally for each developer. And each time a new dependency is added or update you will just need to run the pod update command. to do that you can add to your .gitignore file on a new line just Pods/.
Either way if you are working on a big scale application you should on swift you should follow the best practices and use a correctly .gitignore setup like this one example and also if you want to know some pros and cons on avoiding Cocoapods dependencies you can check this official documentation
In my opinion, we don't push all pods to svn or git. You can commit only Podfile and may want to freeze to a specific version of a Pod, in which case you can specify that version number.
pod 'Objection', '0.9'
And when other members install pods, it will be same.
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
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