开发者

forKeyPath troubles with Quartz Composer and MacRuby

开发者 https://www.devze.com 2023-01-16 15:18 出处:网络
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. Everyt

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消