问题标签 [siesta-swift]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
swift - 如何在 Swift 中使用 Siesta 框架上传文件?
问题很简单:
我需要将 .zip 文件上传到服务器,如何在 Swift 中使用 Siesta Framework 执行此操作?
谢谢你。
swift - Siesta 是否支持 HTTP 长轮询
我有一个 API 端点,它以无穷无尽的 JSON 对象序列进行响应。喜欢
GET /commands?since=112233
{"cmd": "mycommand", "params": [...]}
{"cmd": "othercommand", "params": [...]}
...
会话几乎永远不会结束(服务器有一个设置最终会超时,但典型值是几十万秒)。
有没有办法在 Siesta 中使用这样的 API?
siesta-swift - Siesta Swift:RequestError.Cause.RequestCancelled 不符合 _ErrorCodeProtocol
我正在尝试通过进行一些自定义检查并抛出我自己的自定义错误来检查请求可能引发的确切错误。
我收到此错误:
参数类型“RequestError.Cause.RequestCancelled.Type”不符合预期类型“_ErrorCodeProtocol”
有什么想法可以检查错误的确切原因是什么,然后返回我自己的自定义错误?
ios - Siesta 作为 Linux 上 SwiftPM 的依赖项
我编写了一个使用 Siesta 的包,我希望能够使用 SwiftPM 在 linux 平台上为它运行自动化测试。我看到 siesta 有一个 Package.swift 声明排除了 SiestaUI,但是我看到标准转换器的 AppKit/UIKit 导入Image
被广泛使用,并且 UIImage 引用无法在 linux 上编译。
此外,我特别希望我的消费库能够处理来自 Siesta 的图像。至少,我需要从消费者那里注入能够使用 Siesta 类型的 UIKit 方法。
那么,(1)是否有任何期望 Siesta 可以在 linux 上与 SwiftPM 一起使用?如果是这样,这里的预期流程是什么?似乎 PureSwift/Cacao 和 Silica 可以帮助我解决这个问题,但我的实验并没有以某种方式正确连接,并且不同域类型之间的转换并不明显(即,我想使用 Siesta 来传输图像的 jpeg,但 Cacao 不提供UIImageJPEGRepresentation
) 的实现。
有什么想法吗?
ios - 使用 swift 在 http 请求中发送数值,将 000000000000001 添加到实际值
我正在尝试向服务器执行 HTTP 请求:内容是 JSON 对象,其中包含键“数量”的数值。如果“金额”是带十进制数字的值,例如 1.6,则请求将包含值 1.6000000000000001,并且服务器不接受此值(api 是 Java 制作的,类型是 float 。我无法发送到服务器的字符串,因为从我那里接收数据的 API 只能接受“金额”的数字。我尝试使用 Siesta Framework 或 dataTask 执行请求,但结果始终相同
这就是我创建请求的方式(我省略了不太重要的部分)
swift - 有没有办法用午睡框架增加超时时间
我搜索了 siesta framework 的文档,但找不到为 http 请求设置超时的方法。我需要设置更长的超时时间,因为我正在向一个非常慢的 Web 服务发送一个 http 请求,并且我从框架中收到一个超时错误。我知道我可以配置超时 NSURLSessionConfiguration,但我只需要为某些端点增加超时,而不是为每个请求
resources - 资源在没有观察者时是否被释放?
资源在没有观察者时是否被释放?我有一个场景,我想缓存一些图像,但显示它们的视图可能会来来去去。如果我使用 RemoteImageView 来处理自己对 URL 上键入的图像的观察,但用户来回切换视图导致视图被重用,那么它会丢失正确图像的跟踪。
创建一个专用的 Service 和 EntityCache 以确保图像不会立即从缓存中刷新是否合理?
任何其他建议将不胜感激。谢谢
swift - Making a network request with app in background with Siesta and Swift
I'm making an HTTPS request that's initiated from a UNUserNotification action, so it performs with my app running in the background. I suspect that this feature isn't supported by Siesta, in which case I'll make a feature request! But first I want to see if I'm correct about that.
When I set up & make a request in the background using Siesta, no request appears to be made until I open my app, when I get a URLSessionTask
error code -1003 "HTTP load failed" with message: URL Session Task Failed: A server with the specified hostname could not be found.
.
This is the exact same behavior I see if I use plain URLSession
to make requests, without configuring the session for background execution using the boilerplate:
Is there an out-of-the-box way to get this behavior in Siesta?
ios - ios swift siesta ResourceObserver resourceRequestProgress 从未调用
我正在使用 Siesta 进行 REST 调用,并且正在尝试创建一个简单的 ResourceObserver 来显示 SVProgressHUD。
因为它是一个单例,所以我使用弱引用添加了观察者:
我故意为登录添加了 10 秒的延迟,但是 SVProgressHUD 从未显示,实际上从未调用 resourceRequestProgress 方法。身份验证过程效果很好。
日志输出为:
任何有关使其工作的帮助将不胜感激。