[MacRuby] #131: Dictionary arg not accepted
#131: Dictionary arg not accepted ---------------------------------+------------------------------------------ Reporter: francois@antier.org | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: major | Milestone: MacRuby 0.4 Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ The interpreter finds an error here: @tmp = NSAttributedString.alloc.initWithData(data, options:NSCharacterEncodingDocumentOption, documentAttributes:0, error:outError); /Users/francois/Documents/Essais_xcode_et_Ruby/temp3R/build/Debug/temp3R.app/Contents/Resources/MyDocInRuby.rb:46:in `initWithData:options:documentAttributes:error:': can't convert Ruby object `0' to Objective-C value of type `^@' (ArgumentError) The problem seems to be in the documentAttributes argument; you can pass 0, an NSDictionary, or a Hash, nothing works. Cocoa expects a value of type NSDictionary** for this argument. -- Ticket URL: <http://www.macruby.org/trac/ticket/131> MacRuby <http://macruby.org/>
#131: Dictionary arg not accepted ---------------------------------+------------------------------------------ Reporter: francois@antier.org | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: major | Milestone: MacRuby 0.4 Component: MacRuby | Resolution: Keywords: | ---------------------------------+------------------------------------------ Comment(by lsansonetti@apple.com): So, NSDictionary** means that this argument is returned by reference. Currently this is not implemented in MacRuby, so I will keep this ticket open until it's fixed. In the meantime you can pass "nil", which is the Objective-C nil equivalent (so, C's NULL). Passing 0 will not work, because 0 in Ruby is a fixnum (numeric) object. -- Ticket URL: <http://www.macruby.org/trac/ticket/131#comment:1> MacRuby <http://macruby.org/>
#131: Dictionary arg not accepted ---------------------------------+------------------------------------------ Reporter: francois@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.4 Component: MacRuby | Resolution: fixed Keywords: | ---------------------------------+------------------------------------------ Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed Comment: The Pointer class was introduced in MacRuby trunk to specifically address these problems. {{{ pattributes = Pointer.new_with_type('@') perror = Pointer.new_with_type('@') o = NSAttributedString.alloc.initWithData(data, options:NSCharacterEncodingDocumentOption, documentAttributes:pattributes, error:perror); unless o p perror[0] else p pattributes[0] end }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/131#comment:4> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby