#507: valueForKey(key) no longer working with NSManagedObject subclasses.
-----------------------------------+----------------------------------------
Reporter: johnmacs...@… | Owner: lsansone...@…
Type: defect | Status: new
Priority: major | Milestone:
Component: MacRuby | Keywords: valueForKey, KVC, Core Data
-----------------------------------+----------------------------------------
Comment(by martinlagarde...@…):
Sorry, here is a real reduction that will correctly check:
{{{
#!ruby
framework 'CoreData'
class Student < NSManagedObject
attr_accessor :age
end
if ARGV.count < 1
puts "Usage: #{$0} <xcdatamodel file>"
exit 1
end
# Compile the managed object model so we can open it
`/Developer/usr/bin/momc #{ARGV[0]} /tmp/MacRubyCDKeyCheck.mom`
model = NSURL.URLWithString("file:///tmp/MacRubyCDKeyCheck.mom")
mom = NSManagedObjectModel.alloc.initWithContentsOfURL(model)
s = Student.alloc.initWithEntity(mom.entitiesByName["Student"],
insertIntoManagedObjectContext:nil)
s.valueForKey("age")
}}}
This works by doing so:
{{{
$> macruby kvc.rb ~/Downloads/CDKeyCheck/MacRubyApp.xcdatamodel
NSUnknownKeyException: [<Student 0x40073e9a0> valueForUndefinedKey:]: the
entity Student is not key value coding-compliant for the key "age".
(RuntimeError)
$>
}}}
On trunk:
{{{
$> macruby kvc.rb ~/Downloads/CDKeyCheck/MacRubyApp.xcdatamodel
nil
$>
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/507#comment:3>
MacRuby <http://macruby.org/>
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel