I need some help debugging a very strange error in my application, that happens outside the "normal" app lifecycle.
I'm working on an internal iOS VoIP app. Pretty straight forward. It uses a VoIP stack and I programmed the whole UI / stack handling / user settings on top of it. The app works smooth 99% of the time.
However, about every 10th time the app is activated (and by this I mean either started or reopened by a user tapping the icon or after it dispatched a local notification), the app will freeze. This behaviour rarely ever occurs while debugging, plus when I added some NSLog() outputs, in order to see the app timings, everything from didFinishLaunchingWithOptions (for example) to viewDidAppear on the main view is done no-problem in a few ms.
This is the weird behaviour when this actually happens:
The app is not running, you tap the app icon
-> App Icon is in pushed state, freezes for 3-5s, then shows splash screen and starts normally (no crash)
The app is already running, you tap the app icon
-> App icon is in pushed state, freezes for 3-5s, then opens normally (no crash)
The device is locked, it gets some traffic and triggers a local notification
-> I can swipe the notification but when I click an option, it hangs. Works after 3-5s
So, my question is, how do I debug app freezes that seem to happen outside of the app lifecycle?
Thanks in advance for any answers.