views:

31

answers:

1

Hi All,

I am having some issues with setting values using MacRuby and Cocoa. I have the inserted the QCView and the QCPatchController into the XIB and loaded the composition into the QCPatchController. Everything is running but I cannot access the published inputs on the QCView.

attr_accessor :myQCView #this is bound to the QCController

...
def AppController

txt = "I did it"  
@myQCView.setValue(txt, forKeyPath:"patch.text.value")  

end

I am getting an error:

NSUnknownKeyException: [<NSNull 0x7fff7115e000> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key value. (RuntimeError)

I'm stumped. I have tried searching the MacRuby forums but I have had no luck.

thanks for your advice

A: 

Read the exception message:

NSUnknownKeyException: [<NSNull 0x7fff7115e000> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key value. (RuntimeError)

Why would you be trying to set the key value of an NSNull object?

Let's look at the code. What are you trying to set the key value of?

@myQCView.setValue(txt, forKeyPath:"patch.text.value")  

I see: Your QCView's patch.text.

So, your QCView's patch.text is an NSNull object.

attr_accessor :myQCView #this is bound to the QCController

That's not an accurate name for the variable, then. I suggest “myQCPatchController”, or just “patchController”.

So it now looks like you're trying to set the value of the text port of the root patch. Perhaps the root patch does not actually have a port named text?

You may want to ask about this problem on the Quartz Composer mailing list.

Peter Hosey
Hi Peter, thanks for the response. I had some help from the macruby dev forum and I had the wrong object bound. I had bound the QCController when I needed to bind the QCView (hence the variable name). My other issue was the @. The code that worked was myQCView.setValue(txt, forKeyPath:"patch.text.value".
tsugua