views:

37

answers:

1

I've changed my app class type from NSObject to NSApplication and now I get the following message when testing my app:

Could not connect the action buttonClicked: to target of class NSApplication

What does this mean and how can I fix it?

+2  A: 

NSApplication does not respond to the buttonClicked: method and, therefore, there is no way for the target/action connection to be successfully made.

bbum
How do I fix that?
Moshe
Moshe: Connect the button to an object that *does* respond to `buttonClicked:`. Perhaps you meant to connect it to your application delegate?
Peter Hosey
@Peter - This is the first time I am working on a desktop Cocoa app. I'm coming from iOS development and I'm making a Mac version of my app, baset on Matt Gallagher's AudioStreamer class. How do I *attach* an action? (please post some sample or a link please.)
Moshe
Moshe: Ctrl-drag from the object sending the action to the desired target. Interface Builder will show a pop-up with the available actions to connect it to; if you named your button and the correct action similarly (i.e., your action actually describes what it's supposed to do, not the view that will trigger it), Interface Builder will even position the correct action right under your mouse cursor for you, so all you'll have to do is click.
Peter Hosey
Moshe: Also, I'm curious what provoked the question in your last comment, because you clearly hooked up the button before (to the application object). You hook it up to any other object the same way: ctrl-drag to it and pick the action.
Peter Hosey