So right back into the mix after the chaos of Christmas and I’ve come to make version 1.1 of my most recent project. I started out finding a bug which I hadn’t noticed before (or which hadn’t been vocalised until today) which basically spewed out the error (in the title of this article)
It didn’t stop the app from running normally and the issue was fairly easy to track down, though I thought I’d post the solution just in case you didn’t find it anywhere else. Yes… I’m talking to YOU!
Okay so here’s where I went wrong. In my app delegate I instantiate a class to set up my default data for the app. The content of this really isn’t important. However, if there’s an issue with that set up – I had the class show a UIAlertView message and this is what was causing the issue. In the ‘didFinishLaunching’ method of the app delegate where I was calling my class, the view wasn’t yet available. So when the alert came up, it was just before the view was drawn. This is what all the fuss was about.
I decided to fix it by returning a BOOL value from the data set up and then after the window was drawn, using the value to display (or not) the warning. All very straight foward. Not really sure whether it would have caused an issue in a production app – but good to know anyway. Other people online reported similar things, but most related to the order in which things took place.