plugins
plugins copied to clipboard
[background-http] events not fired on device
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...