Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Photo Browser iPhone App Downloading Data with NSURLSession NSURLSession Basics

Lee Watkins
Lee Watkins
11,345 Points

FTP Uploads with NSURLSession

Hi All

I'm trying to implement FTP uploads (and downloads) with NSURLSession - I believe that it has the capabilities to do so. I was wondering if anyone could help provide any direction on how to achieve this?

Thanks! UniekLee

2 Answers

Holger Liesegang
Holger Liesegang
50,595 Points

Hi Lee Watkins ,

you might want to have a look at the CFNetwork Programming Guide - Working with FTP Servers section "Uploading a File" but it's not a fun thing to do...

...and for the Does NSURLSession support FTP upload? you don't want to go this way :)

Lee Watkins
Lee Watkins
11,345 Points

Hi Holger Liesegang

Thanks for the response! I was hoping that NSURLSession would provide something simpler that CFNetworking.

I've tried using a number of libraries based on CFNetworking to try and simplify things for me, but I'm getting malloc errors (pointer being freed was not allocated) with all of them. And Crashlytics is suggesting that that error is coming from somewhere within CFNetworking. It's a bit of a problem!

Holger Liesegang
Holger Liesegang
50,595 Points

This might be what you've been looking for as a quick fix to get your thing working:

SimpleFTPSample

"SimpleFTPSample shows how to do simple FTP operations using the NSURLConnection and CFFTPStream APIs ... it can upload a file, list a directory, and create a directory using CFFTPStream."