I’m facing a mysterious crash with the following scenario:
Launch the app
Lock the device
Unlock the device (with home button)
Make an HTTP request
The app crashes
I can’t reproduce it on the simulator, only on a real device, and I can’t debug the crash:
The debugger detaches when the device gets locked
Even if I declare a custom UncaughtExceptionHandler to print the stack trace, nothing appears
so I don’t kown what is happening.
The only thing I’m sure of, is that the crash happens immediately after a call to an HTTP API. I can log the call, and sometimes the result (not always), then the app crashes.
I use Retrofit for the all the network part, so I can’t manage the connections myself. I’ve read in this post that it could be a matter of unclosed session.
How can I deal with this problem? Has anyone already faced the same crash?
Hi saeed, thanks for your reply. The baseUrl is fine, sometimes I even get the result of the call before the crash, so I don’t think it is related to the request itself.
I also noticed this weird behavior on my iOS device.
This behavior may refer to [SOLVED] iOS app crashes from Broken Pipe .
What actually helped was the following line of code in my Main Class:
@Override
public boolean applicationDidFinishLaunchingWithOptions(UIApplication application, NSDictionary launchOptions) {
apple.c.Globals.sigignore(13); // avoid SIGPIPE Crashs after 2nd launch
....
@Jucl It’s been 2 years, why did I not see your reply sooner!!! I found a workaround but last week the issue came back and I see the fix only now, arrrgh