[MacRuby-devel] NSManagedObject being returned in delegate as Pointer

Nic Williams drnicwilliams at gmail.com
Tue Dec 30 19:32:13 PST 2008


In this code sample: http://gist.github.com/41855 I am getting a
Pointer instance instead of an NSManagedObject_Recipe instance (from
Core Data). Subsequently the setValue:forKey: call at the end of the
delegate/callback method fails.

The top method addImage(sender) launches an NSOpenPanel, which
delegates to the second/last method
addImageSheetDidEnd:returnCode:contextInfo: when the panel is closed.

But instead of passing through the NSManagedObject_Recipe instance to
the contextInfo: recipe value, I am getting a Pointer.

Is this correct? Or how do I get my NSManagedObject_Recipe instance
from the Pointer. MacRuby src for Pointer class doesn't suggest it has
any methods for getting the pointed-to thing.

    rb_cPointer = rb_define_class("Pointer", rb_cObject);
    rb_undef_alloc_func(rb_cPointer);
    rb_define_singleton_method(rb_cPointer, "new_with_type",
rb_pointer_new_with_type, 1);
    rb_define_method(rb_cPointer, "assign", rb_pointer_assign, 1);
    rb_define_method(rb_cPointer, "[]", rb_pointer_aref, 1);

Cheers
Nic

-- 
Dr Nic Williams
iPhone and Rails consultants - http://mocra.com
Fun with iPhone/Ruby/Rails/Javascript - http://drnicwilliams.com
* Surf Report for iPhone - http://mocra.com/projects/surfreport/ *


More information about the MacRuby-devel mailing list