Alex Rivera | Logout

Could not connect the action: to target of class NSApplication

Asked 2011-07-19T02:12:56.570
11

I keep getting Could not connect the action startServer: to target of class NSApplication error on compile. I understand what the error is but not sure how to fix it. Somehow my xib is trying to invoke startServer method in NSApplication which doesn't exist.

Edit
Report

1 Answer

22

It sounds as if you connected your UI element to the File's Owner object, which is an instance of NSApplication.

If you haven't done so already, you want to drag a NSObject out of the Object Library palette in Xcode 4 to the margin to the left of your layout. Once you've done that, and have selected it, choose the identity inspector and, in the Class field, enter "WindowController".

Now that you've got a representation of your WindowController, which as you said contains startServer:, then you can connect your UI element to that. Be sure your startServer method is of the form:

- (IBAction)startServer:(id)sender

or you won't be able to make the connection.

Good luck to you in your endeavors.

answered 2011-07-19T02:32:20.320

Your Answer