【发布时间】:2017-08-25 12:46:32
【问题描述】:
我在func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { URLSessionDataDelegate 方法中收到此错误:
error=可选(错误域=NSURLErrorDomain 代码=-1 “未知错误” UserInfo={NSErrorFailingURLKey=https://www.example.com/, NSLocalizedDescription=未知错误, NSErrorFailingURLStringKey=https://www.example.com/})
非常相似的代码可以在应用程序中完美运行,但我正在尝试编写一个共享应用程序扩展来上传到网络服务器。
我使用的 URLSessionConfiguration.background(withIdentifier:"...") 与我的桌面应用程序相同。
为什么我得到 erorr -1?
【问题讨论】:
标签: macos nsurlsession macos-app-extension