What does Pod Repo Remove Master do? - ios

So I am very new to CocoaPods and I want some clarification on a command.
I had an error that said Unable to find a specification for 'Firebase/Core' and after multiple tries of different commands the only thing that worked was Pod repo remove master. Can anyone tell me why that worked and what it did?

The Master(Specs) Repo is the repository on GitHub that contains the list of all available pods. In case it is broken or not up-to-date you might face issues while installing or updating your pods.
By pod repo remove master you removed the master repo which might be broken or not up-to-date.

Related

Why can't i install my newly created CocoaPod?

I created a framework and wanted to distribute it via CocoaPods. For that I published the code to CocoaPod's Specs github repository (https://github.com/CocoaPods/Specs.git) using the command:
pod trunk push RXSStoryblokClient.podspec
The pod was successfully pushed to the trunk (https://github.com/CocoaPods/Specs/commit/b0a141b3c741d757090f61d1579ec92a7c0ebfb6) and on the outside everything seems to have worked. But when I create a small test project and try to install the newly created pod by adding it to the podfile and running
pod install
it tells me: Unable to find a specification for 'RXSStoryblokClient'
I have tried (as suggested by cocoapods) to update the repo using the
pod repo update
command, but this didn't resolve the issue.
Any help in this matter would be greatly appreciated!
The issue actually resolved itself. It seems CocoaPods had not finished some indexing work and 48h after pushing the pod spec to github, the installation finally worked.

iOS Practice for using cocoapod and source control

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.

What is the ideal way to deploy pods to the artifactory?

Disclaimer - I am very new to cocoapods. This might be a very silly question for most ios developers.
The artifactory documentation link for uploading cocoapods is quite explanatory and easily understandable. I have followed the steps and I have tried uploading a well known pod (ABCustomUINavigationController) to the my own local instance of artifactory.
The deployment section of the documentation says
I am using the Web UI for deploying the pod (in .tar.gz format) to the artifactory. The way I've done that is:
Is this the ideal way to deploy pods? Also, if I want to upload a xcodeproj (build output) of the pod along with the .podspec file, then how should I go about it?
Thanks.
I see you uploaded the pod itself under the .specs folder of your repo, this is actually where Artifactory keeps the index that the pod client later retrieves when you use pod repo-art add or pod repo-art update. Although there's no restriction as to where to put the pods themselves I would keep them out of the .specs folder to keep things organized for yourself.
As for build outputs - A CocoaPod typically contains source code (and perhaps other resources) that a project can include and not the output of the build of a project so I'm not sure what is the benefit of uploading extra content (such as build products) with it and separated from it.
In any case the way the pod client handles pods is by searching for a proper entry in the index (i.e. everything that's under .specs in your repo) that satisfies the required version defined in your project's Podfile and then using the address in that index file (which points back to Artifactory in our case) to download the required Pod.
So in other words, anything else you put in the repository which is not a tarballed pod is ignored both by Artifactory and by the pod client.
For MAC users:
Step 1:
brew install gnu-tar
Reason: As default mac uses tar for zipping and which has problems with jFrog artifactory
Usage:
gtar czvf swift-sdk.tar.gz *
gtar czvf testPOD.tar.gz testPOD/testPOD/* testPOD/testPOD.podspec
Note: Make sure unnecessary files not get zipped. For instance if .git present in zip, it creates lot of issues.
Step 2:
Follow official link and video
https://www.jfrog.com/confluence/display/RTF/CocoaPods+Repositories#app-switcher
Some of the useful commands:
For add spec repo to the local machine:
pod repo-art add cocoapods-local "http://localhost:8081/artifactory/api/pods/cocoapods-local"
For repo update:
pod repo-art update cocoapods-local
Push artifacts to jFrog:
curl -uadmin123:123456 -XPUT http://localhost:8081/artifactory/cocoapods-local/testPOD/0.1.0/ -T testPOD.tar.gz
Cocoapod spec repo:
source 'https://github.com/CocoaPods/Specs.git'
Point to spec repo in Podfile:
plugin 'cocoapods-art', :sources => [
'cocoapods-local'
]

podspec specification does not validate

I'm trying to create a cocoa pod following this tutorial. I'm stuck at the moment where I'm doing the following command:
pod repo push RWPodSpecs RWPickFlavor.podspec
the problem is that I've got the following error:
Validating spec
[!] The `RWPickFlavor.podspec` specification does not validate.
And not further error description unfortunately. What I tried was reinstalling cocoapods and installing cocoapods keys, but it didn't help. I'm still getting the same error. Any ideas, guys?
I solved this issue by adding option --allow-warnings.
While the OP's issue was fixed, using this command will give more information about anyone else's issue. For me, I forgot to push the new version tag to my remote.
pod repo push [repo] [podspec] --verbose
Oh, the problem was very simple actually. I was simply being unobservant. In my .podspec file I had one of the urls formatted like that : ["https://github.com/Andrey-C/RWPickFlavor.git"]. Once I removed the square brackets around the url the error vanished.
Sometimes pod spec lint doesn't update changes (this is because of cache).
Once I fixed some errors specified by lint, pushed, updated tag, etc., and ... got the same errors as before.
So you can fix it by cleaning cache:
cd /Users/<#your-user-directory#>/Library/Caches/CocoaPods/Pods
just delete /Pods directory and pod spec lint will work again
For me, I needed to add a revision tag to my master branch and then git push with all tags before the pod trunk push would pass validation.
Use the following command:
pod trunk push RWPickFlavor.podspec
It publishes your newly created pod to CocoaPods repository, creating a pod with name that specified in your .podspec file.
You also have to use such command to publish a new version of your pod.

Cocoapods: Pod is in the master repo but is not available for install

I've created and submitted a podspec, BCJSONMapper, but when I search for it using pod search BCJSONMapper I receive the following error: [!] Unable to find a pod with name matching 'BCJSONMapper'.
The spec is in the master repo (it was submitted via trunk). I can use the pod as expected if I refer to a local copy of the podspec in a podfile (pod 'BCJSONMapper', :podspec => '~/path/to/local/copy/of/BCJSONMapper.podspec').
How do I fix this? This is the first podspec that I've submitted to the master repo so I may have missed something obvious.
I've fixed it. I solved it by removing my ~/.cocoapods/repos/master and letting Cocoapods re-initalize the repo. What was confusing was that the same error message was occurring on a different machine. It may have just been coincidence, but I guess it could also have been a bug in Cocoapods.

Resources