Greetings Morgan, Ouput up to crash point is as expected (yes, a valid entityDecsription does get returned). Here's an example of the output
Importer:initialize Importer:importEntities Ignoring duplicate x-coredata://1FF5D00F-B928-4254-A770-762329EB6F05/Node/p189 Ignoring duplicate x-coredata://1FF5D00F-B928-4254-A770-762329EB6F05/Node/p187 awakeFromInsert tags: #<_NSFaultingMutableSet:0x200c780a0> NodeProxy:tagEntityExists? Looking for tag: one 2011-02-25 15:41:25.446 Knowledge[1929:a0f] HIToolbox: ignoring exception 'Unable to parse the format string "AND"' that raised inside Carbon event dispatch Note the HIToolbox error this time as opposed to an EXC_BAD_ACCESS error. Oh Well. BTW, I enjoyed your blog entry about MacRuby/CoreData - keep blogging. Fait cop on the lack of Ruby-esqueness, my excessue is that I started with S/360 assembler and I'm not convinced this OO stuff will really catch on :-) - Jonathan On 24 Feb 2011, at 20:30, Morgan Schweers wrote: > Greetings, > What's the output up to the crash point? > > I didn't realize you could do Pointer.new(:id), I'm still using > Pointer.new_from_type('@'). :) > > Check entityDescription for nil, also. If for some reason it can't resolve > your entity it'll return nil, and that might blow up in a way like you're > seeing. > > (Presuming the exception is being thrown from under executeFetchRequest.) > > Just a few guesses from a fellow traveler on the Core Data highway. :/ > > -- Morgan > > p.s. It could also be tweaked to be more Ruby-esque, but that won't help with > the problem... > > On Thu, Feb 24, 2011 at 8:58 AM, Jonathan Waddilove <jonat...@waddilove.net> > wrote: > Hi, I'm trying to apply a predicate to a core data fetch and hitting > EXC_BAD_ACCESS. > > I've successfully used NSPredicate to filter an array's contents, but all my > attempts to use NSPredicate with Coredata fail. > > I'm using framework 'Coredata' and framework 'Foundation' and this is the > method that fails: > > def tagEntityExists?(tag, moc) > puts 'NodeProxy:tagEntityExists?' > entityDescription = NSEntityDescription.entityForName('Tag', > inManagedObjectContext:moc) > request = NSFetchRequest.alloc.init() > request.setEntity(entityDescription) > > puts "Looking for tag: #{tag}" > predicate = NSPredicate.predicateWithFormat("name == %@", tag) > request.setPredicate(predicate) > > error = Pointer.new(:id) > > puts "request: #{request.description}" > begin > results = moc.executeFetchRequest(request, error:error) > rescue Exception => bang > puts bang > end > > unless results > puts "Fetch failure: #{error.description}" > return nil > end > puts "Will return: #{results.inspect}" > return results[0] > end > > and here's the backtrace I get: > > > #0 0x00007fff86ef42bc in _qfqp2_InitializedGlobalData () > #1 0x0000000102d61fe0 in ?? () > #2 0x000000010014a0b3 in rb_vm_dispatch () > #3 0x0000000102d5ab26 in ?? () > #4 0x0000000102d62c56 in ?? () > #5 0x000000010014bcd6 in rb_vm_dispatch () > #6 0x0000000102d5ab26 in ?? () > #7 0x0000000102d626da in ?? () > #8 0x000000010014e1f7 in rb_vm_yield_args () > #9 0x0000000100102ad8 in rb_yield () > #10 0x0000000100176f38 in rb_ary_freeze () > #11 0x000000010014bd16 in rb_vm_dispatch () > #12 0x0000000102d5ab26 in ?? () > #13 0x0000000102d62383 in ?? () > #14 0x000000010014bcd6 in rb_vm_dispatch () > #15 0x0000000102d5ab26 in ?? () > #16 0x0000000102d61906 in ?? () > #17 0x000000010014bcfb in rb_vm_dispatch () > #18 0x0000000102d5ab26 in ?? () > #19 0x0000000102d61542 in ?? () > #20 0x000000010014e1f7 in rb_vm_yield_args () > #21 0x0000000100102ad8 in rb_yield () > #22 0x0000000100176f38 in rb_ary_freeze () > #23 0x000000010014bd16 in rb_vm_dispatch () > #24 0x0000000102d5ab26 in ?? () > #25 0x0000000102d60c59 in ?? () > #26 0x000000010014bd16 in rb_vm_dispatch () > #27 0x0000000102d5ab26 in ?? () > #28 0x0000000102d6073d in ?? () > #29 0x000000010014bcfb in rb_vm_dispatch () > #30 0x00000001000f2bbe in rb_objc_isEqual () > #31 0x00000001000f2d8e in rb_objc_isEqual () > #32 0x00007fff837d1e9a in -[NSApplication sendAction:to:from:] () > #33 0x00007fff837f641e in -[NSMenuItem _corePerformAction] () > #34 0x00007fff837f6188 in -[NSCarbonMenuImpl > performActionWithHighlightingForItemAtIndex:] () > #35 0x00007fff83a7a279 in -[NSMenu _internalPerformActionForItemAtIndex:] () > #36 0x00007fff8392bf77 in -[NSCarbonMenuImpl > _carbonCommandProcessEvent:handlerCallRef:] () > #37 0x00007fff837d895c in NSSLMMenuEventHandler () > #38 0x00007fff8109b9d5 in DispatchEventToHandlers () > #39 0x00007fff8109af28 in SendEventToEventTargetInternal () > #40 0x00007fff810b8beb in SendEventToEventTarget () > #41 0x00007fff810e7d51 in SendHICommandEvent () > #42 0x00007fff81114b86 in SendMenuCommandWithContextAndModifiers () > #43 0x00007fff81114b3e in SendMenuItemSelectedEvent () > #44 0x00007fff81114a3e in FinishMenuSelection () > #45 0x00007fff810f5d13 in MenuSelectCore () > #46 0x00007fff810f5468 in _HandleMenuSelection2 () > #47 0x00007fff836a97dd in _NSHandleCarbonMenuEvent () > #48 0x00007fff8367d317 in _DPSNextEvent () > #49 0x00007fff8367c7a9 in -[NSApplication > nextEventMatchingMask:untilDate:inMode:dequeue:] () > #50 0x00007fff8364248b in -[NSApplication run] () > #51 0x00007fff8363b1a8 in NSApplicationMain () > #52 0x0000000102d5ea5d in ?? () > #53 0x000000010014a658 in rb_vm_dispatch () > #54 0x0000000102d5ab26 in ?? () > #55 0x0000000102d5a4dc in ?? () > #56 0x0000000100162d53 in rb_vm_run () > #57 0x00000001000408f0 in ruby_run_node () > #58 0x000000010015a332 in macruby_main () > #59 0x0000000100000f20 in main (argc=1, argv=0x7fff5fbff6c8) at > /Users/jonathan/Desktop/ > > Um, any suggestions? I see that there are previous list entries about this > sort of problem but I think there are now all closed.... > > > Many thanks and regards, Jonathan > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > >
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel