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?
I was missing the com.apple.security.network.client
entitlement in the entitlements
file.