Odd error on iOS devices


I’m seeing some odd errors on iOS devices that happen sporadically when my application tries to post data over HTTP and transition to a new page (not sure if either of those or even the combination of them could be the cause). The error is thrown, caught, and reported to the back-end through my logging service, but doesn’t seem to be accompanied by any informative messages (fyi, I’m logging error.stack from the UI). Here’s what gets logged:

iPhone 1

iPhone 2

Like I said previously, this error only seems to happen on iOS devices, and happens sporadically. Specifically, the error happens in 2 places in my application and here’s what’s common about both blocks of code:

  1. The blocks of code are triggered by a user clicking on a button
  2. The user clicking on the button first triggers an HTTP call to a back-end service
  3. A couple locally stored elements are updated
  4. The user gets transitioned to the next page

There are a couple other places where we do the above but don’t get the same error, so I’m not quite sure what’s up with these particular parts of the application.

Any ideas what could be causing this? Any help would be greatly appreciated!

Please let me know if there’s any other information I could provide that would be of help.


This screams “race condition” to me. Have somebody (not you, if possible, because fresh sets of eyes seem to find things that original authors don’t see) audit all of the code that relies on results from asynchronous sources, including ensuring all object and array properties in controllers are initialized if they are referenced from templates.

Thanks for your feedback @rapropos! I have not yet had a fresh set of eyes look at that portion of the code (mostly because I don’t work with too many other Ionic developers), but I know of one person who I can reach out to. I’ll give them a shot and let you know if I find anything. Thanks again!

This ended up being a bug on my end due to the way promises were being chained in the HTTP class. Whenever an HTTP error is encountered the class has some logic in place to retry the call, but the last ‘then’ in the promise-chain within the retry block wasn’t returning the response to the invoker, who would then receive null, which then led to the issue mentioned. I’m not quite sure why the HTTP error occurs in the first place, but the application works after I resolved the issue in the retry block so I’m not going to spend time debugging the service.