Callback or notification when Sentry is ready?

#1

Hi there. I’m using the Sentry iOS client. Had an issue where crashes werent reported back to the Sentry panel, reason being they happened so early in the lifecycle of the app, that either Sentry werent properly initalized at that stage, or it simply didnt have enough time to send the existing crash reports back to the server, before the app crashed again.

So I’m wondering if I can either get a notification when Sentry is ready and properly initialized, or maybe a callback. If possible, I’ll postpone all other app activities (and possible sources of crash behaviour) - improving the chance of the crashes to actually being sent back to the Sentry server.

#2

Initializing Sentry is synchronous, in theory it can happen that another thread crashes your app but if you init Sentry in AppDelegate you should be fine (not sure if you do it earlier).

There is no “fully initalized” callback and probably doesn’t solve your problem.

In regards to crashing again before sending it off, there is no good solution for this since sending works in background and doesn’t block.

#3

Ok, thanks for your quick response.
Yes, I initialize Sentry in the AppDelegate.

Did a pretty lo-fi test the other day, and my findings were that Sentry needed at least 1.3 seconds to ship off the crash reports to the server. Any less than that, and it became either unreliable or didn’t work at all. Of course several other factors play a role here, such as network speed, the amount of data (crash reports) that needs sending etc. But my conclusion was that if I postpone all other app activities 2 seconds (using a loading/spinner view), Sentry has enough time to reliably send crash reports, if any.