NativeScript / nativescript-background-http

Background Upload plugin for the NativeScript framework
Apache License 2.0
101 stars 50 forks source link

Nativescript 7 Error #270

Open gregersen79 opened 3 years ago

gregersen79 commented 3 years ago

Only testet on iOS @nativescript/ios": "7.0.0".

Please, provide the following version numbers that your issue occurs with:

When I upload a file, I get the error below. The file gets uploaded correct though.

Fatal JavaScript exception - application has been terminated. NativeScript encountered a fatal error: Uncaught Error: -[NSInvocation getArgument:atIndex:]: NULL address argument at readProp(file: node_modules/@nativescript/background-http/index.ios.js:218:0) at get upload(file: node_modules/@nativescript/background-http/index.ios.js:235:0) at onProgress(file: node_modules/@nativescript/background-http/index.ios.js:7:0) at (file: node_modules/@nativescript/background-http/index.ios.js:78:0) (CoreFoundation) Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught Error: -[NSInvocation getArgument:atIndex:]: NULL address argument at readProp(file: node_modules/@nativescript/background-http/index.ios.js:218:0) at get upload(file: node_modules/@nativescript/background-http/index.ios.js:235:0) at onProgress(file: node_modules/@nativescript/background-http/index.ios.js:7:0) at (file: node_modules/@nativescript/background-http/index.ios.js:78:0) ', reason: '(null)' First throw call stack: ( 0 CoreFoundation 0x00007fff2043a11e __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff20177f78 objc_exception_throw + 48 2 NativeScript 0x00000001054802b4 _ZN3tns21NativeScriptException15OnUncaughtErrorEN2v85LocalINS1_7MessageEEENS2_INS1_5ValueEEE + 882 3 NativeScript 0x00000001058ad668 _ZN2v88internal14MessageHandler25ReportMessageNoExceptionsEPNS0_7IsolateEPKNS0_15MessageLocationENS0_6HandleINS0_6ObjectEEENS_5LocalINS_5ValueEEE + 344 4 NativeScript 0x00000001058ad4c9 _ZN2v88internal14MessageHandl<…>

msaravitz commented 3 years ago

I'm having the same issue, have you found any workaround for now?

mreall commented 3 years ago

Has anyone figured out a workaround?

msaravitz commented 3 years ago

Has anyone figured out a workaround?

I commented out the offending code in the readProp function and that has been working so far. Though I believe you will lose the upload progress tracking.

3rror404 commented 3 years ago

Commenting line 254 of index.ios.ts / line 220 of index.ios.js prevents the crash:

invocation.getReturnValue(ret);

I'm still receiving the progress and complete events with the line removed on iOS 14. I haven't tested elsewhere yet.

mreall commented 3 years ago

Thanks @3rror404, that worked for me. For anyone else fairly new to manually updating plugins and wants to fix this while waiting for the official update, here's what I did. Let me know if there's a better process.

  1. Forked @nativescript/plugins and cloned the repo locally.
  2. In the local repo, ran npm setup to initialize the packages.
  3. Commented out line 254 of packages/background-http/index.ios.ts.
  4. Ran npm start and selected @nativescript.background-http.build to build the package.
  5. From my NS 7 project, ran ns plugin add ../ns-plugins/plugins/dist/packages/background-http to add the modified plugin to my app (of course you'll need to replace the path with the path on your local machine).
3rror404 commented 3 years ago

A major problem with this change is that you lose the ability to monitor progress with task.upload and task.totalUpload.

andreasteffanoni commented 3 years ago

Same issue. Thanks @3rror404, your workaround worked for me as well.

benediktveith commented 3 years ago

+1

3rror404 commented 3 years ago

There is a PR that is working great for me on iOS.

https://github.com/NativeScript/plugins/pull/16

JWiseCoder commented 3 years ago

I'm also having this issue.

luiguild commented 3 years ago

For me in Android and iOS, using NS7 and 5.0.1 version and not working at all