NativeScript / NativeScript/plugins

[background-http] events not fired on device

未关闭
#236 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
206
派生
123
平均合并
2 天 1 小时
30 天内合并 PR
1

描述

Hi,

I try to upload an image to a Server via backtround-http. It works correct on android and on iOS-Simulator, but on a real iOS-device, the task-events are not fired.

  • "@nativescript/ios": "8.1.0",
    
  • "@nativescript/background-http": "^5.0.2",
    
  • "@nativescript/core": "~8.1.5",
    

Simulator: iOS 15.2
Device: iOS 15.2.1

const bghttp = require("@nativescript/background-http");
let session = bghttp.session("file-upload");
let request = {
        url: this.backendURL + "images/",
        method: "POST",
        headers: imageHeaders,
        description: "multipart/form-data",
    }
let params = [
        { name: "file", filename: imagePath, mimeType: "image/png" }
    ];
let task = session.multipartUpload(params, request);
task.on("progress", function(e) {
            console.log("uploaded " + e.currentBytes + " / " + e.totalBytes);
        });

    task.on("error", function(e) {
        console.log("error!");
        console.log(e);
        console.log(e.response);
    });

    task.on("responded", function(request) {
        console.log("responded");
    }

Any ideas?

I can not reproduce it on severall smartphones/ipads, but have one device with this behavior...

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用列出的 NativeScript、iOS 和 background-http 版本,在真实的 iOS 设备上重现 multipart 上传,然后将其 progress、error 和 responded 回调与模拟器进行比较。完成标准是确定受影响设备上为何没有 task 事件,并确认这些回调在上传过程中表现正确。

由索引模型根据 Issue 内容生成。

评估

技术栈
ios, javascript, typescript
领域
mobile, networking
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。