[MacRuby-devel] CFRange (Boxed) elements not accessible

Laurent Sansonetti lsansonetti at apple.com
Sun May 30 18:47:49 PDT 2010


Hi Paul,

I believe that here the function is typed to return an anonymous struct (likely a bug in the bridgesupport file), so MacRuby won't be able to associate it as an NSRange. You may be able to access location using string_range[0] and length using string_range[1].

Laurent

On May 30, 2010, at 6:19 PM, Paul Howson wrote:

> Hello Laurent and team,
> 
> The following code:
> 
>     string_range = CTLineGetStringRange(line)
> 
> returns a CFRange, which is a C-structure with two elements: location and length.
> 
> Attempting to access:
> 
>     string_range.location
> 
> results in the error message:
> 
>     undefined method `location' for #<Boxed:0x200699fe0> (NoMethodError)
> 
> (I think a similar error related to CLLocation has been discussed here before.)
> 
> Is there a way to get around this problem?
> 
> -----------------
> Paul Howson
> Warwick Qld Australia
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list