[MacRuby-devel] Key-Value Compliance & valueForKey:

Patrick Rogers helloresolvenapps at gmail.com
Thu Nov 17 12:44:27 PST 2011

Hi everyone,

I'm trying to automatically generate the KVC-compliant methods for indexed to-many relationships.  

Here's my current attempt, https://gist.github.com/1374142, which borrows from hotcocoa's kvo_array (I couldn't get `kvo_array` to work and I wanted something that could just automatically be backed by an Array).

Anyways, countOf<Key> and objectIn<Key>AtIndex: are both generated and work.

However, when I try and use valueForKey(<key>) on my generated keys, MacRuby crashes with:

> unknown: [BUG] unknown Objective-C immediate: 0x1 (nil)
> MacRuby 0.11 (ruby 1.9.2) [universal-darwin10.0, x86_64]
> [1]    26123 abort      macruby kvo_array.rb

It is my understanding this should return an array based on my countOf<Key> and objectIn<Key>AtIndex: methods.

On the other hand, when I use the manually defined methods, valueForKey(...) works as expected.

Is there an issue with my code/approach or is this a MacRuby bug?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20111117/eb876dac/attachment-0001.html>

More information about the MacRuby-devel mailing list