Hello,
I'm trying to write custom behaviour for assert on iOS. If an assert is triggered, I want to show a dialog, that would inform the user, that a critical error occurred. However, since an assert can occur before the main window is loaded, the dialog must be shown regardless of the main window, which I'm having difficulties with.
Is there any good practice on iOS to do this?
In Swift and Objective-C asserts and exceptions are typically not used to communicate an error state other than a program error that is so fundamental that the program should terminate immediately.
The better approach would be to write your app so that it uses proper error objects to communicate 'expected' errors that are part of the states your app can be in.
Either way though, you can not display any UI on iOS before your app is fully running. So if you have any errors that happen during this time, you would probably need to hold on to the error object, wait until the application is running and connected to a scene and then display the error.