I’m thinking I’m in trouble because I’m trying to show an alert (with UIAlertView) before I add my first view to the window.
I want to initialize the SQLite3 database when the app loads. The code goes like this:
if (![self initDB]) NSAssert(0, @"Failed to initialize database"); ... // initialize tab bar controller with some nav controllers // Add the tab bar controller's current view as a subview of the window [window addSubview:tabBarController.view];
If initDB runs into trouble and tries to show an alert (for example, trying to show ‘disk full’ when failing to copy the database to the Documents folder), I get an exception. Am I not able to show an alert until at least one view has been added to the window?
Any suggestions for workarounds? I tried initializing the DB after adding the tabBarController view to the window, but ran into an exception. Some kind of race maybe.