everburning

home quotes

MacRuby and NSError

11 Jun 2009

Just a note for other people that might be cracking their heads trying to meld MacRuby and NSError ** parameters. The answer was already sitting on my computer, I just never through to look at the MacRuby Core Data XCode templates, but that's beside the point. For those of you searching, you just need to do the following.

error = Pointer.new_with_type('@')
unless managed_object_context.save(error)
  NSLog error[0].inspect
  NSApplication.sharedApplication.presentError(error[0])
end

The NSLog error[0].inspect will output #<NSError:0x80057a640>. Exactly what we want.

Tags — Cocoa, Computers, MacRuby, and Programming