【发布时间】:2016-04-12 14:34:39
【问题描述】:
我正在尝试使用 NSURLSession 和来自 OSX 共享扩展的后台任务上传数据。
一旦我开始执行任务,委托就会被回调,并带有世界上最没有帮助的错误消息:
The operation couldn’t be completed. (NSURLErrorDomain error -995.)
NSError 对象中没有其他信息,控制台中也没有。
在网上搜索后,我唯一的线索是确保我已经正确设置了configuration.sharedContainerIdentifier,但是我已经这样做了:
let configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(uniqueId)
configuration.sharedContainerIdentifier = Config.appGroupName
urlSession = NSURLSession.init(configuration: configuration, delegate: self, delegateQueue: nil)
然后我准备请求并创建任务:
let task = self.urlSession!.dataTaskWithRequest(request)
self.tasks.append(task)
task.resume()
请注意,在我的主应用程序中一切正常。只是共享扩展失败了。
还有哪些问题会导致错误-995?
【问题讨论】:
-
this question 怎么样?
-
这只是告诉我设置
sharedContainerIdentifier,我已经说过我已经完成了。 -
向 Apple 提交错误。该错误代码应该记录在案,而不是。只有 Apple 的人才能告诉你这很可能意味着什么,除非有人碰巧偶然发现了它。
标签: macos networking nsurlsession