errorp = Pointer.new_with_type("@")

result = NSXMLDocument.alloc.initWithData(data, options:NSXMLDocumentValidate, error:errorp)

# access error
errorp[0]


On 26 Apr 2009, at 16:36, Alex Vollmer wrote:

Is it possible to use "out" parameters with MacRuby, such as NSError? In my particular case I'd like to capture errors that result from parsing XML with NSXMLDocument using the initWithData:options:error: method. I tried (naively) just instantiating an NSError instance and handing it to that method, but ended up with this:

irb(main):037:0> e = NSError.new
=> #<NSError:0x80067cc40>
irb(main):038:0> doc = NSXMLDocument.alloc.initWithData(data, options:NSXMLDocumentValidate, error:e) ArgumentError: can't convert Ruby object `#<NSError:0x80067cc40>' to Objective-C value of type `^@'
        from (irb):38:in `initWithData:options:error:'
        from (irb):38
        from /usr/local/bin/macirb:12:in `<main>'

Any help or insight is appreciated.

Cheers,

Alex
----
Musings & Notes — http://alexvollmer.com
Track what you lend and borrow — http://moochbot.com





_______________________________________________
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

Reply via email to