Question

I have a stupid problem with Xcode. Sometimes - and I don't know why, because I always follow the same procedure - if I create an IBAction from the nib file of my NSViewController to the .h-file of this NSViewController, I get the error "Could not connect the action buttonCancelClicked: to target of class NSViewController".

It's crazy, because the File's Owner is set to the .h-file and even if I click the button, the IBAction is called. Only Xcode throws this error.

Is this a bug of Xcode? Can I do something to remove this error?

Était-ce utile?

La solution

An NSViewController serves to manage NSViews. Disconnect the button first. Declare the action in (maybe another) class, save, and read the header in IB again and connect it in IB the button. That's how I do it and never had a problem.

Autres conseils

Another reason that will generate this message is when the class identifier is not pointing to the correct Project. I had copied a class from one project to another.

My initial class identifier looked as follows:

enter image description here

This generated the console messages as shown in the original question.

I set the class then as follows:

enter image description here

This solved the problem.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top