So I'm using a library that's been abandoned but I've made quite a few changes within its files under Pods. If the pods are reinstalled, the library won't work. What's the best practice for this sort of thing?
I have forked the project over and updated it with my changes.
Instead of having the line:
pod "PodToIntall"
I have
pod "PodToInstall", git: => "the url to my fork", branch: => "master"
If I try to pod install I get the error
[!] Unable to find a specification for 'PodToInstall'
The project is dead so if I can't get the owner to merge my changes is there any way to pull it off my github?
Check that all steps are done from the following list:
Change the source files from your forked pod project.
Commit it & push to GitHub (if pod is hosted here).
Update the Podfile within your main project to use forked pod.
Run in terminal pod update PodToInstall.
Also CocoaPods and GitHub forks might be useful.
Related
Ive been trying to add a Xcode project to a repository on GitHub and it worked however the pods are not within the project and says they are missing. What is the proper way to add a project with the pods to GitHub?
It depends on what your project needs are.
Benefits of checking in the Pods directory
After cloning the repo, the project can immediately build and run, even without having CocoaPods installed on the machine. There is no need to run pod install, and no Internet connection is necessary.
The Pod artifacts (code/libraries) are always available, even if the source of a Pod (e.g. GitHub) were to go down.
The Pod artifacts are guaranteed to be identical to those in the original installation after cloning the repo.
Benefits of ignoring the Pods directory
The source control repo will be smaller and take up less space.
As long as the sources (e.g. GitHub) for all Pods are available, CocoaPods is generally able to recreate the same installation. (Technically there is no guarantee that running pod install will fetch and recreate identical artifacts when not using a commit SHA in the Podfile. This is especially true when using zip files in the Podfile.)
There won't be any conflicts to deal with when performing source control operations, such as merging branches with different Pod versions.
Source
I personally have the following in my .gitignore file:
# CocoaPods
#
Pods/
I am following a github repository. When I go to create the podfile using pod init the terminal says
[!] Existing Podfile found in directory
When I show the project in the finder, I see a pdfile as a exec instead of a text file so to speak.
Should I delete it and run pod init once more? What is the best way to successfully clone this github repo using cocoa pods?
Thats all right. You can open it via any text editor (like Sublime Text). Or just run pod install, open your Demo.xcworkspace and in Pods you will see your Podfile.So you can edit it directly from Xcode.
I'm working on an Xcode project (Swift) that utilizes cocoapods. After completing my tasks, everything worked. I then committed and pushed to my GitHub repository. Then I downloaded the project as a zip from the repository to make sure everything was good. Everything looks fine, but the pods are not there. As a result, in the downloaded version the pods are in red. Is there any way to fix this?
(sorry if this is really simple, I'm just new to GitHub and I haven't found a solution anywhere online)
The question here is basically: How do I make everything compile after cloning/downloading my project.
It seems that you did not commit your Pods into your source control, so the short answer is: Just run pod install
If you want more details about wether you should commit your Pods or only your Podfile, and about Cocoapods in general, this guide is a good starting point.
When you push everything to github, you will need to check the “select all files”. so that your push to github actually sends the pod directory and the Podfile.lock.
Sometimes you need to manually go into the proj3ct directory in terminal and type “git add .” (Hope that’s the command)
Check your github repo and see if they exist and contain files.
You probably don’t have a .gitignore, but if you do, the. Make sure that you are not ignoring pod files. Otherwise they will never be written to the repository.
If the pod files are in the repo you shouldn’t need to do a pod install. But if all else fails, that’s what you need to do.
Recently, I was going about modularization of my company's iOS app, and we chose to use cocoapods to manage modules.
----- this is background -----
Yesterday, I tried to upload a module to our private spec repo, thus I executed the following command (in the podspec directory)
pod repo push [private repo name] --allow-warnings --sources='[private repo git address]' --verbose --use-libraries
However, when the cocoapods was downloading some private dependencies, I found some of the dependencies' version were not the latest, which result in the failure of xcodebuild step (Because we changed the name of some functions in the latest version).
The module's podspec file dependency part: (I didn't specify the version of dependencies, cause I want latest)
...
s.dependency 'HomeJump'
...
(The latest version of HomeJump in my private spec repo is 0.1.6, but every time I executed pod repo push xxx, the version of HomeJump it installed was 0.1.5)
PS:
When I execute pod spec lint xxx, the HomeJump version is 0.1.6, which is correct.
And I've already tried to run pod repo update, rm -rf /Library/Cache/Cocoapods, reinstall my private repo ...
Somebody has any ideas?
Well... finally I found out the reason.
Every time the pod repo push xxx command is executed, cocoapods will find the corresponding version for each dependency in a automatically created spec repo, which has different name with your private spec repo (the name form is kind of like 'git server name - group name - repo name'). This temporary spec repo is related to your private spec repo.
The solution is: delete the temporary spec repo and run pod repo push xxx again
list your cocoapods repo by running pod repo list
find the one which is not created manually by yourself which is also related to your private spec repo
run rm -rf [the repo directory name]
This is my first time forking a GitHub project, and I'm not too competent with CocoaPods either, so please bear with me.
Basically, I forked a project on GitHub using the following in my Podfile:
pod 'REActivityViewController', '~> 1.6.7', :git => 'https://github.com/<username>/REActivityViewController.git'
I then made some changes to the fork, and of course when I did a pod install to install another pod it reinstalled the original REActivityViewController and erased my changes.
I'm realizing I need to push my changes to my fork before another pod install, but how do I know it is the fork being installed, considering that this is a repo installed by CocoaPods? I looked in the REActivityViewController folder installed under the Pods folder and there aren't any git files.
Do I need to work on my fork outside of my project and then use CocoaPods to install the changes? That's too cumbersome of a workflow.
Or do I need to do something with submodules?
I will answer this question using an example. I have a fork of TTTAttributedLabel with some extra functionality I added here:
https://github.com/getaaron/TTTAttributedLabel
In order to use this in a Cocoapods project, I:
Push my changes to my fork
Configure my Podfile to get the changes & update
Once you've pushed your changes to your fork, get the SHA of your last commit. You can do this using git rev-parse origin/master | pbcopy or on the GitHub commits page for your project:
Then, you can specify the specific commit on your fork in your Podfile like this:
pod 'TTTAttributedLabel', :git => 'https://github.com/getaaron/TTTAttributedLabel.git', :commit => 'd358791c7f593d6ea7d6f8c2cac2cf8fae582bc1'
After that, pod update will update this particular commit from your fork. If you want, you can also make a podspec for your fork, but I find this approach simpler and I don't make changes frequently enough to justify a new workflow.
Do I need to work on my fork outside of my project and then use Cocoapods to install the changes? That's way to cumbersome of a workflow.
You can do it this way, but I usually:
Edit the code inside my project and make sure it works
Copy the changes over to my fork, by
exporting a patch, or
copying over the entire source code file
Commit & push to GitHub
Update the Podfile with the new SHA
Run pod update.
Or do I need to do something with submodules?
No, you don't need to.
Another option is to have your project reference the pod directly and not via github. This way you don't have to keep committing your fork or copying/pasting code just to test your changes. You can work with two different Xcode projects simultaneously and commit separately into their respective projects.
pod 'AFNetworking', :path => '~/Documents/AFNetworking'
CocoaPods Documentation:
http://guides.cocoapods.org/using/the-podfile.html#using-the-files-from-a-folder-local-to-the-machine
CocoaPods and GitHub fork
You have two variants to work with fork
[Podfile specific branch]
[Podspec specific branch]
The difference is in the first variant you must push changes into remote/origin branch, while the second variant allows you just commit changes in a local branch