11684
11684

Reputation: 7507

Interface Builder doesn't show IBActions

The Problem

I have a class (AppController) with two outlets and two actions.
The two outlets are picked up by Interface Builder and connected fine.
The two actions, though, are not present in the HUD window appearing when ctrl+clicking the AppController object in Interface Builder, nor do they show up in Library->Classes->AppController->Actions.

AppController.h

#import <Cocoa/Cocoa.h>


@interface AppController : NSObject {
    IBOutlet NSWindow *newDownloadSheet;
    IBOutlet NSBox *downloadsBox;
    NSString *sourceFileURL;
    NSString *destinationFileName;
    NSMutableArray *downloads;
}

- (IBAction)newDocument; // New Download - to respond to File->New, delegates to showNewDownloadSheet:
- (IBAction)showNewDownloadSheet (id)sender;

@end

In the .m file they are defined (although AFAIK Interface Builder doesn't even look at .m files). Also, my code compiles fine (without warnings) and does 'run', it just can't do anything because I can't connect the IBActions.

System Information

Mac OS X 10.6 – yes, I know it's old. My computer is too, so I can't upgrade.
XCode 3.2.6
Interface Builder 3.2.6

Why This Is Not A Duplicate

I could find two other questions on SO on the same problem, but none of the answers worked for me.

  1. Why doesn't IB see my IBAction? Answers suggest to
    1. reload the relevant class file manually (File->Read Class File...). Tried, didn't work.
    2. add ...: (id)sender;. As you can see, one of my actions has this, one doesn't, yet neither shows up.
    3. set the File's Owner correctly. This isn't relevant to my problem since I don't try to connect to the File's Owner object, but to a separately added Object with its identity correctly set to AppController. Plus the Outlets do show up.
  2. IBAction doesn't show up in interface builder The only answer is the same as 1.2.

Upvotes: 1

Views: 350

Answers (1)

zaph
zaph

Reputation: 112857

- (IBAction)showNewDownloadSheet (id)sender;
is incorrect, should be
- (IBAction)showNewDownloadSheet: (id)sender;

Notice the missing ":".

Upvotes: 2

Related Questions