- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
error: Execution was interrupted, reason: signal SIGABRT. The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
我正在尝试在 Playground 中使用 backdround 配置创建 URLSessionWebSocketTask
,但不幸的是我遇到了上述错误
import Foundation
let urlSession = URLSession(configuration: .background(withIdentifier: "___ID___"))
let webSocketTask = urlSession.webSocketTask(with: URL(string: "wss://echo.websocket.org")!)
最佳答案
我明白了,
遵守后台传输限制
对于后台 session ,实际传输是由与应用进程分开的进程执行的。由于重新启动应用程序的进程相当昂贵,因此一些功能不可用,从而导致以下限制:
session 必须提供事件传递的委托(delegate)。 (对于上传和下载,委托(delegate)的行为与进程内传输相同。)
仅支持 HTTP 和 HTTPS 协议(protocol)(无自定义协议(protocol))。
始终遵循重定向。结果,即使你有实现的urlSession(_:任务:willPerformHTTPRedirection:newRequest:completionHandler:),它没有被调用。
仅支持从文件上传任务(从数据上传应用退出后实例或流失败)。
关于ios - 无法使用后台配置创建 URLSessionWebSocketTask,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58096154/
error: Execution was interrupted, reason: signal SIGABRT. The process has been left at the point whe
我目前在我的 WatchOS 6 应用程序中使用新的 URLSessionWebSocketTask 时遇到了一些问题。服务器端要求我首先通过 HTTP header 发送身份验证数据,然后才能建立
我是一名优秀的程序员,十分优秀!