nativescript-background-http icon indicating copy to clipboard operation
nativescript-background-http copied to clipboard

Nativescript 7 Error

Open gregersen79 opened this issue 3 years ago • 11 comments

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

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

  • CLI: 7.0.4
  • Cross-platform modules: 7.0.0
  • Runtime(s): @nativescript/ios": "7.0.0"

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<…>

gregersen79 avatar Sep 09 '20 10:09 gregersen79

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

msaravitz avatar Sep 19 '20 19:09 msaravitz

Has anyone figured out a workaround?

mreall avatar Sep 23 '20 02:09 mreall

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.

msaravitz avatar Sep 23 '20 02:09 msaravitz

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.

3rror404 avatar Sep 26 '20 14:09 3rror404

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).

mreall avatar Sep 28 '20 17:09 mreall

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

3rror404 avatar Sep 28 '20 19:09 3rror404

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

andreasteffanoni avatar Sep 29 '20 08:09 andreasteffanoni

+1

benediktveith avatar Sep 29 '20 08:09 benediktveith

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

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

3rror404 avatar Sep 30 '20 15:09 3rror404

I'm also having this issue.

JWiseCoder avatar Nov 02 '20 14:11 JWiseCoder

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

luiguild avatar Nov 18 '20 23:11 luiguild