> ## Content Index
> Fetch the complete content index at: https://albertodebortoli.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# The solution to FTP on iOS: GoldRaccoon
- URL: https://albertodebortoli.com/2014/08/01/the-solution-to-ftp-on-ios/
- Published: 2014-08-01T22:22:00.000Z
- Updated: 2019-04-20T09:21:57.000Z
- Author: Alberto De Bortoli
- Tags: FTP, iOS, open source

[GoldRaccoon](http://albertodebortoli.github.io/GoldRaccoon/?ref=albertodebortoli.com) is the iOS component to connect to a FTP service and do the following:

- Download a file
- Upload a file
- Delete a file
- Create a directory
- Delete a directory
- List a directory

## Why another Raccoon?

First, because the humanity needs it.

This project started on 29/06/2013 for the Objective-C Hackathon ([http://objectivechackathon.appspot.com/](http://objectivechackathon.appspot.com/?ref=albertodebortoli.com)).

[GoldRaccoon](https://github.com/albertodebortoli/GoldRaccoon?ref=albertodebortoli.com) aims to be an evolution of [BlackRaccoon](https://github.com/lloydsargent/BlackRaccoon?ref=albertodebortoli.com) (which is an evolution of [WhiteRaccoon](https://github.com/valentinradu/WhiteRaccoon?ref=albertodebortoli.com)), maybe the best (or at least one of the few) third-party component out there for handling FTP operations on iOS.

I forked the public repo of BlackRaccooon in May 2013 and added some improvements that have been merged into master to BlackRaccoon. Even though BlackRaccoon does what it says, I prefer to clean it a little and use a different and more extensible code structure.

Most of the code is therefore written by [Valentin Radu](https://github.com/valentinradu?ref=albertodebortoli.com) and [Lloyd Sargent](https://github.com/lloydsargent?ref=albertodebortoli.com), the main extensions I ([Alberto De Bortoli](https://github.com/albertodebortoli?ref=albertodebortoli.com)) added are:

- Done some deep refactoring for the bloating of the previous code;
- Added missing (and reasonable) code conventions;
- Added GRRequestsManager to manage all the different kind of requests using a FIFO queue;
- Added a demo project.

## Usage

If you'd like to include this component as a pod using [CocoaPods](http://cocoapods.org/?ref=albertodebortoli.com), just add the following line to your Podfile:

`pod "GoldRaccoon"`

otherwise

- copy Sources folder into your project
- add CFNetwork framework
- import `GRRequestsManager.h` in your class
- add a property for the manager

```objective-c
@property (nonatomic, strong) GRRequestsManager *requestsManager;

```

- setup the manager somewhere (with hostname, username and password)

```objective-c
self.requestsManager = [[GRRequestsManager alloc] initWithHostname:<hostname>
                                                              user:<username>
                                                          password:<password>];

```

- optionally make your class conform to `GRRequestsManagerDelegate`, implement the delegate methods (basically success, failure and progress callbacks) and set your instance of this class as delegate for the manager

```objective-c
self.requestsManager.delegate = self;

```

- add the requests to the manager using the following methods:

```objective-c
addRequestForListDirectoryAtPath:
addRequestForCreateDirectoryAtPath:
addRequestForDeleteFileAtPath:
addRequestForDeleteDirectoryAtPath:
addRequestForDownloadFileAtRemotePath:toLocalPath:
addRequestForUploadFileAtLocalPath:toRemotePath:

```

- start the manager

```objective-c
[self.requestsManager startProcessingRequests];

```

## Conclusion

While we know that FTP is going obsolete more and more every day, we also ackowledge the fact that legacy technologies are always gonna stick around for longer than desired.