NSURLSession from macos Sharing Extension

336 Views Asked by At

I'm getting this error in the func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { URLSessionDataDelegate method:

error=Optional(Error Domain=NSURLErrorDomain Code=-1 “unknown error” UserInfo={NSErrorFailingURLKey=https://www.example.com/, NSLocalizedDescription=unknown error, NSErrorFailingURLStringKey=https://www.example.com/})

Very similar code works perfectly from an application, but I'm trying to write an Sharing App Extension which uploads to a webserver.

I'm using URLSessionConfiguration.background(withIdentifier:"...") same as my desktop application.

Why do I get erorr -1?

1

There are 1 best solutions below

0
On BEST ANSWER