10

So I'm starting out with cocoa and ObjC. I'm trying to follow the example in the up and running objective C/cocoa book from oreilly. My applicationDidFinishLaunching doesn't seem to be getting called. I think it's a problem with the way I hooked everything up in the IB.

Header: http://pastebin.com/6AdQt1uN

Class: http://pastebin.com/VCQWJWkj

IB: http://img265.imageshack.us/img265/4616/screenshot20110216at111.png

Does anyone see anything obvious that my untrained eyes do not?

Realn0whereman
  • 1,176
  • 2
  • 13
  • 17

3 Answers3

18

Does your Application object have it's delegate set to your Application App Delegate object? Right click on Application in your IB window and set the delegate outlet to be your Application App Delegate object.

Dominic
  • 3,304
  • 19
  • 22
2

A guess: you didn't set the object where you defined applicationDidFinishLaunching as the delegate for your app.

Michael J. Barber
  • 24,518
  • 9
  • 68
  • 88
  • Didn't I do that as shown by the picture in the referencing outlets section? I right clicked on Window, and dragged delegate outlet to my class file in the document view (in the IB). – Realn0whereman Feb 16 '11 at 16:28
  • That's for the *Window*, not the *Application*. They're two different objects. See my answer below - you need to set the delegate on the Application itself. – Dominic Feb 16 '11 at 16:30
0

for those who do not use IB, make sure you specify the app delegate in main.m in the following way:

        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

instead of:

        return UIApplicationMain(argc, argv, nil, nil);
Fabio Napodano
  • 1,210
  • 1
  • 16
  • 17