I've been working on an app that uses URLSession's dataTask to pull data from an FTP server. I know it's deprecated but unfortunately the only public API the system I'm working with offers is FTP-based.
About once in every 150-200 connections I'll randomly get a EXC_BAD_ACCESS crash that seems to come from somewhere in CFNetwork. Hoping maybe someone can make more sense of it than I've been able to. The previous version of the app that I wrote for iOS 6 using NSURLConnection doesn't appear to have this problem.
So, let’s start you off with my On FTP post. It say:
There is at least one known crashing bug (r. 35745763)
Based on the backtrace in your crash report, I believe you’re hitting this bug. I’m not aware of any workaround for this.
You wrote:
The previous version of the app that I wrote for iOS 6 using
NSURLConnection
doesn't appear to have this problem.
Interesting. NSURLSession
and NSURLConnection
share a common core, so most low-level problems like this replicate with both APIs. However, it’s possible that NSURLConnection
manages to tiptoe through the landmines in this case. Assuming it’s not too much hassle, you might try changing your new app to use NSURLConnection
to see if that improves things.
But, realistically, if you have a long-term dependence on FTP for mission critical work then I strongly recommend that you get off the CFNetwork implementation. It’s officially deprecated, is not being actively maintained, and is probably going to accumulate more problems over time.
Alternatively, if the FTP server you’re talking to is on the public Internet, bring up your own server that acts as a front end for it. This has a couple of advantages:
-
You can talk to your server using HTTPS, which is safe and reliable.
-
Your server can use a supported FTP library to talk to the real server.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"