Kodeco Forums

Carthage Tutorial: Getting Started

In this Carthage tutorial, you'll learn all about what Carthage is, how to install it, and how to declare, install, and integrate your dependencies.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/416-carthage-tutorial-getting-started

Thanks for the tutorial on Carthage. I’m stuck at trying to use Carthage to download the Alamofire dependencies:

carthage update --platform iOS

results in the following error:

*** Cloning Alamofile
A shell task (/usr/bin/env git clone --bare --quiet https://github.com/Alamofire/Alamofile.git /Users/cdisdero/Library/Caches/org.carthage.CarthageKit/dependencies/Alamofile) failed with exit code 128:
remote: Invalid username or password.
fatal: Authentication failed for ‘https://github.com/Alamofire/Alamofile.git/’

I found a posting about this at: Carthage 0.7.1 asking for GitHub username/pass for public repos · Issue #447 · Carthage/Carthage · GitHub.

I do have the git caching credential helper installed and tried doing:

git config --global credential.helper osxkeychain

with no errors, but this didn’t help. I also tried:

carthage update --platform iOS --use-ssh

but this resulted in the error:

*** Cloning Alamofile
A shell task (/usr/bin/env git clone --bare --quiet ssh://git@github.com/Alamofire/Alamofile.git /Users/cdisdero/Library/Caches/org.carthage.CarthageKit/dependencies/Alamofile) failed with exit code 128:
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Any ideas are appreciated. Thanks.

Hi @cdisdero. Thanks for your feedback. Do you have an ssh key setup in your machine in order to access Github repo?

Yes I do have a valid SSH key setup for GitHub.

I finally got it to work. I wiped all my keys on GitHub, created a new key and added to GitHub, then I had to use the command: carthage update --platform iOS --use-ssh.

I hate the step with Build phase script adding, because it’s boring and repetitive, so I have released Swift script that does it for you GitHub - artemnovichkov/Carting: 🚘 A simple tool for updating Carthage script phase

Hi,
Could we use Carthage and Cocoapods at the same time in our project.
I am facing a hurdle for adding third party dependency library. Currently the library is only available in Carthage but my existing project is using Cocoapods as its dependency manager.

Any recommendation if i could use both Carthage and Cocoapods in the same project. I am feeling it might not be a good idea.

I’m not on XCode 9 yet - can you leave the old version of this tutorial on the website?

@artemnovichkov thanks for sharing this!

Sorry @dgdosen for this but right now we support Xcode 9 for our new tutorials. Are you able to download it?

Thanks @animeshtirkey. I think there is no problem to use CocoaPods and Carthage at the same time. I’ve never tried it. Usually I tend to use only one dependency manager. Have you tried to use both?

You’re welcome! Feel free for any suggestions.

@lorenzoboaro, thanks for this great tutorial! As the code is not integrated in the project, how to set some break points in it, or how can we integrate it in the project?

@lorenzoboaro Can you please help with this when you get a chance? Thank you - much appreciated! :]

@idevelopper Thanks for your feedback. One way is to put a breakpoint as shown below.

image

As soon the breakpoint stops, just click the icon highlighted with the red circle:

image2

Click it twice (at first you will reach imageView variable definition). You will step into the code that belongs to AlamofireImage.

Let me know if you need something else.

Thank you :]

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!