EXC_BAD_ACCESS (code=1, address=0x2) with URLSession.shared.dataTask

Viewed 127

I'm trying to get to the bottom of a problem with happens infrequently and unpredictably.

I have the following code:

let task = URLSession.shared.dataTask(with: requestURL) { data, response, error in

(which then goes on to handle the response)

Periodically it will crash with EXC_BAD_ACCESS (code=1, address=0x2) and, despite all my reading about this, I can't seem to figure out what is causing this and how to avoid it. Articles that I've read say it's a "programmer error" but what that error is, isn't made clear.

This is on macOS 10.15 in Xcode 11.1.

Help appreciated!

0 Answers
Related