I have a need to make an API call on application exit (to collect session data in an analytics platform). I make a network.request POST when there is an applicationExit system event.
When I’m working in the simulator and save a piece of code the simulator tries to refresh, issues an applicationExit (and fires my POST correctly), then starts re-loading the simulator. It then crashes the simulator. I assume it’s because the network.request is generating a callback to my listener which no longer exists.
It doesn’t seem to be a huge problem on the actual devices, but I wonder what it’s doing in the background and whether it will cause other problems.
Is it possible to issue a network.request POST without including a listener so that it doesn’t try to call me back, or is there a better way to handle this sort of requirement?