App crash due to too long awakeFromNib

318 Views Asked by At

I'm creating a simple app on Xcode with the user interface including only one window that contains only 5 labels. I just want to show a few text in the labels using dates. I do all the work in the -awakeFromNib method. But when I build and run the app, the icon appears and crashes immediately without showing any window. As I guess, the -awakeFromNib is too loaded to run. When I delete the half of the code, everything just works fine.

How can I deal with such a huge -awakeFromNib? Should I write the code to another method? Note that when I change the method from -awakeFromNib to -applicationDidFinishLaunching:, the same stuff happens.

1

There are 1 best solutions below

0
On

Your analysis of the problem is almost certainly incorrect. The method is not "too long"; the half of the code that you removed just happened to contain a bug. Running your application in the XCode debugger will probably identify the code at fault.