https icon indicating copy to clipboard operation
https copied to clipboard

NSErrorFailingURLKey is null

Open enyineer opened this issue 6 years ago • 7 comments

Hello. I just created a new NativeScript test application. When I run "tns run ios --syncAllFiles" and then do a request behind a proxy (which fails because the emulator is not behind that proxy) the plugin throws an error. In https.ios.js on line 64 "error.userInfo.objectForKey('NSErrorFailingURLKey')" evaluates to "null" which crashes the app because "null is not an object (evaluating 'error.userInfo.objectForKey('NSErrorFailingURLKey').description')".

enyineer avatar Jan 28 '19 14:01 enyineer

I am getting the same issue. Is this plugin still being working on?

ghost avatar May 30 '19 17:05 ghost

I'm facing the same issue in one of our applications. Any inputs or workarounds on how this can be resolved?

hkurma avatar Apr 23 '20 02:04 hkurma

I was just hit by this, and after fighting a bit with it i found the issue in my case.

When passing, "Content-Type": "application/json" and another header (in my case an auth token) make sure the response returns parseable json otherwise you get those crashes. Alternatively put another header like text/html

PolCPP avatar Jul 23 '20 01:07 PolCPP

I will fix this!

farfromrefug avatar Jul 23 '20 05:07 farfromrefug

@farfromrefug , thanks. As long as the responses are ok it should be fine anyway, my guess it's AFJSONResponseSerializer that explodes on invalid responses.

PolCPP avatar Jul 23 '20 10:07 PolCPP

@PolCPP fixed in the repo. @EddyVerbruggen needs to publish it

farfromrefug avatar Jul 23 '20 12:07 farfromrefug

Oh, awesome! Thanks!

PolCPP avatar Jul 23 '20 12:07 PolCPP