NSObject in IB doesn't work

Hello,

I basically created a new class in my project to have more cleanness. Some of the functions in this script need to be connected to objects in IB so I dragged a new “Object” item and set my new class as custom class for this Object.
In this way I have been able to connect an action to a button, but as soon as I run the app I get this error and the button doesn’t seem to be connected to anything.

2015-06-29 09:18:02.213 App Name[811:66624] Unknown class '_TtC12App_Name7ClassName', using 'NSObject' instead. Encountered in Interface Builder file at path /Users/Me/Library/Developer/Xcode/DerivedData/App_Name-enomcrajcidxpygksgpxejpkrycv/Build/Products/Debug/App Name.app/Contents/Resources/Base.lproj/MainMenu.nib. 2015-06-29 09:18:02.338 App Name[811:66624] Could not connect action, target class NSObject does not respond to -myActionName:
Any help would be really appreciated.

Thanks.

What is the name of your new class (ie, what appears after the word script)?

MSItems

It sounds like the NSObject cube’s class has not been changed correctly. Check that first – or better still, delete it and try again.

Thanks, that was the solution!

Another little problem (I write here to not open new useless topics):

In the class MSItems I have a function like this:


on didFinishLaunching()
        set defaults to current application's NSUserDefaults's standardUserDefaults()
        set defaultValues to {mydefaults}
        defaults's registerDefaults_(defaultValues)
end didFinishLaunching

This functions is called from the App Delegate willFinishLaunching: method (I’m sure that it’s called). But when in another functions of the class MSItems I try to set a default using:


defaults's setObject:myObject forKey:"myKey"

…I get the error: missing value cannot understand the message "setObject_forKey_"
If I put the stuff in didFinishLaunching in another method (always in MSItems) called by a button, it works.

What’s wrong?

Do you have a property called defaults? And that should be “set my defaults to…”.

Yes, I have the property, just forgot to say that. Nevertheless, even by adding the keyword my it doesn’t work and gives the same error.

Is it in a class method?

The easiest thing is to use current application’s NSUserDefaults’s standardUserDefaults() again.

Yes, in the end I used again it.

Thanks