Comments (9)
Hi @michitosh,
Could you provide more details on the iOS version and device used? And how the plugin has been initialized and is being used in the code? We might not be getting into this debug right now but a PR with the necessary fixes will be most welcome and greatly appreciated.
Thanks,
Azhar
from cordova-plugin-background-upload.
Hi @azharbeebeejaun ,
Cordova v10.0.0
Cordova iOS v6.2.0
iPhone X iOS 14.5
The Plugin is initialized in the device ready listener:
`document.addEventListener('deviceready', function () {
uploader = FileTransferManager.init({
parallelUploadsLimit: 5
});
uploader.on('success', function (upload) {
uploader.removeUpload(upload.id, function () {
//upload aborted
}, function (err) {
//could abort the upload
});
});
[...]
});`
The payload is added like this:
db.executeSql('SELECT * FROM XXXX WHERE draft_id=?', [SQLiteId], function (rs) {
var payload = {
"id": rs.rows.item(i).id,
"filePath": rs.rows.item(i).imagepath,
"fileKey": "file",
"serverUrl": postlink + "api/" + api_version + "/Upload",
"showNotification": true,
"notificationTitle": language[lang].lang_upload_progress,
"headers": {
"X-ACTION": "media-upload",
"AUTHTOKEN": userdata.auth
},
"parameters": {
"gp_id": DraftId,
"fileName": uploadFileName
}
};
uploader.startUpload(payload);
}, function (error) {
console.log('UPDATE error: ' + error.message);
});
from cordova-plugin-background-upload.
I've just got the same issue. The iOS version is the 16.1.1 on a iPhone 13 Pro Max. Here's the error and how is initialized and used.
Error:
2022-11-29 18:19:40.271807-0300 App[7123:1776752] -[App.AppDelegate backgroundCompletionBlock]: unrecognized selector sent to instance 0x280576600
2022-11-29 18:19:40.272866-0300 App[7123:1776752] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[App.AppDelegate backgroundCompletionBlock]: unrecognized selector sent to instance 0x280576600'
*** First throw call stack:
(0x1af075e88 0x1a83a38d8 0x1af1ea84c 0x1b1f785ec 0x1af08bfa0 0x1af0f4350 0x1044ecb2c 0x1044f1c10 0x1a94f32f0 0x1a94c74a0 0x1a94c7430 0x1a94887d8 0x1a948850c 0x1a948dc20 0x10479f1d0 0x10478e05c 0x10479e810 0x10479e354 0x1af1066f8 0x1af0e8058 0x1af0eced4 0x1e83ea368 0x1b15cb3d0 0x1b15cb034 0x104028f74 0x1cd754960)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[App.AppDelegate backgroundCompletionBlock]: unrecognized selector sent to instance 0x280576600'
terminating with uncaught exception of type NSException
Init:
uploader = BackgroundUpload.init({
callBack: event => {
console.log(event);
switch (event.state) {
case 'UPLOADING':
console.log('Still uploading')
break
case 'UPLOADED':
console.log('upload done')
break
case 'FAILED':
if (event.id) {
console.log("upload: " + event.id + " has failed");
} else {
console.error("uploader caught an error: " + event.error);
}
}
if (event.eventId) {
console.log('Event done and ACK')
uploader.acknowledgeEvent(event.eventId)
}
}
})
How is used:
for (const photo of photos) {
const payload: FTMPayloadOptions = {
id: uuidv4(),
filePath: photo.filepath,
fileKey: "file",
serverUrl: serverUrl,
notificationTitle: "Uploading images",
};
uploader.startUpload(payload);
}
The upload works fine, but at the end, the error message is presented and the app freezes/crashes.
from cordova-plugin-background-upload.
Hello @matheuscas ,
Can you send me your version of background upload you are using.
from cordova-plugin-background-upload.
Hey @zfir , thanks for asking, here my dependencies:
"dependencies": {
**"@awesome-cordova-plugins/background-upload": "^6.2.0",**
**"@awesome-cordova-plugins/core": "^6.2.0",**
"@capacitor/android": "^4.0.0",
"@capacitor/camera": "^4.0.0",
"@capacitor/core": "^4.0.0",
"@capacitor/filesystem": "^4.0.0",
"@capacitor/ios": "^4.0.0",
"@capacitor/preferences": "^4.0.1",
"@ionic/pwa-elements": "^3.1.1",
"@ionic/react": "^5.0.7",
"@ionic/react-router": "^5.0.7",
"@testing-library/jest-dom": "^5.5.0",
"@testing-library/react": "^10.0.2",
"@testing-library/user-event": "^10.0.1",
"@types/jest": "^25.2.1",
"@types/node": "^13.11.1",
"@types/react": "^16.9.34",
"@types/react-dom": "^16.9.6",
"@types/react-router": "^5.1.5",
"@types/react-router-dom": "^5.1.4",
"@types/uuid": "^9.0.0",
**"cordova-plugin-background-upload": "^1.1.0",**
"ionicons": "^5.0.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"typescript": "^3.8.3",
"uuid": "^9.0.0"
},
from cordova-plugin-background-upload.
Hello @matheuscas,
You should install this version :
cordova plugin add @spoonconsulting/cordova-plugin-background-upload
Also make sure the version is 4.0.7
, 1.1.0
is outdated.
from cordova-plugin-background-upload.
Hey @zfir , one more information that maybe can help you, I believe. Here the steps:
- As soon as I press "Upload all" button to upload all photos I lock the phone
- Everything stays fine until I unlock the phone and get back to the app.
- After that, I get the above mentioned exception and the app crashes.
I hope that this helps you.
from cordova-plugin-background-upload.
Hello @matheuscas,
You should install this version :
cordova plugin add @spoonconsulting/cordova-plugin-background-upload
Also make sure the version is
4.0.7
,1.1.0
is outdated.
Hello @matheuscas,
Can you try this and let me know if you have the same error
from cordova-plugin-background-upload.
@zfir Problem solved. Since I'm using Capacitor, I npm installed @spoonconsulting/cordova-plugin-background-uploa
and cordova-plugin-file
rather than adding it using cordova
command. The only errors showed after unlocking the phone were below, but they didn't crash the app. Thank you for your help and for your work on this plugin.
To Native Cordova -> FileTransferBackground acknowledgeEvent FileTransferBackground1259045247 ["options": [x-coredata:///UploadEvent/tC4B2041A-DAE2-429A-ADFD-9139B982F19B10]]
2022-11-30 13:21:21.309004-0300 App[8088:2128155] error deleting UploadEvent <UploadEvent: 0x2828f0550> (entity: UploadEvent; id: 0x280b8e300 <x-coredata:///UploadEvent/tC4B2041A-DAE2-429A-ADFD-9139B982F19B9>; data: {
data = nil;
}) : Error Domain=NSCocoaErrorDomain Code=134030 "An error occurred while saving." UserInfo={NSAffectedObjectsErrorKey=(
"<UploadEvent: 0x2828f0550> (entity: UploadEvent; id: 0x280b8e300 <x-coredata:///UploadEvent/tC4B2041A-DAE2-429A-ADFD-9139B982F19B9>; data: {\n data = nil;\n})"
)}
2022-11-30 13:21:21.309604-0300 App[8088:2128155] error deleting UploadEvent <UploadEvent: 0x28289af30> (entity: UploadEvent; id: 0x280d17fc0 <x-coredata:///UploadEvent/tC4B2041A-DAE2-429A-ADFD-9139B982F19B10>; data: {
data = nil;
}) : Error Domain=NSCocoaErrorDomain Code=134030 "An error occurred while saving." UserInfo={NSAffectedObjectsErrorKey=(
"<UploadEvent: 0x2828f0550> (entity: UploadEvent; id: 0x280b8e300 <x-coredata:///UploadEvent/tC4B2041A-DAE2-429A-ADFD-9139B982F19B9>; data: {\n data = nil;\n})"
)}
from cordova-plugin-background-upload.
Related Issues (20)
- minCompileSDK(31) specified in a dependency's AAR metadata androidx.work:work-runtime:2.7.1 HOT 3
- How to modify FileUploader.m to use basic PUT request (not multipart) HOT 2
- Uploads fail due to multipart/mixed HOT 1
- UPLOADED event fires off when the responseCode is 4xx HOT 6
- Upload fails silently when using cordova-labs-local-webserver on iOS HOT 2
- Upload by 64encoded content not uri path + Background Download HOT 3
- File Upload's don't work if the file has a "space" in the filename. IOS & Android HOT 1
- File not found (Android) HOT 38
- "[email protected]" does not satisfy dependency plugin requirement HOT 7
- Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent HOT 6
- Is there a way to get the list of pending upload tasks? HOT 2
- Supported Android Versions? HOT 1
- Unable to install 2.0.7 HOT 12
- Unable to specify mime type
- error: 'Upload Settings object is missing or has invalid arguments' HOT 1
- this.uploader.on(...) is not a function HOT 3
- File not found since Capacitor 5 HOT 1
- Unable to remove queued upload
- initializing FileTransferManager twice causes callbacks to not be sent
- Errors during init doesn't throw and event for the callback HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-background-upload.