On May 2, 2010, at 3:50 PM, Craig Williams wrote:

Than you Laurent,

I have been searching all over for Boxed but not CLLocation.

Sorry about that. I'm afraid the only solution right now is to wrap this inside an ObjC class and use it from MacRuby.

btw, is there a projected timeframe when MacRuby will be OSA compliant?
No rush, just wondering. ;)

Maybe in 0.7!

Laurent

On May 2, 2010, at 3:14 PM, Laurent Sansonetti wrote:

Hi Craig,

I believe you're hitting http://www.macruby.org/trac/ticket/641

Laurent

On May 2, 2010, at 11:48 AM, Craig Williams wrote:

This works in Objective-C but in MacRuby I cannot find a way to access the properties of the Boxed object that is returned by loc.coordinate in the code below.

Thanks,

Craig


MacRuby Version 0.7 -> pulled today

OS -> 10.6.3


Objective-C version:
  CLLocation *loc = [[CLLocation alloc] initWithLatitude:38.0 longitude:-122.0];
  NSLog(@"Lat: %.2f", loc.coordinate.latitude);
  NSLog(@"Long: %.2f", loc.coordinate.longitude);
  [loc release];
  
  // Result:
  // 2010-04-30 16:48:55.568 OCCoreLocationTest[70030:a0f] Lat: 38.00
  // 2010-04-30 16:48:55.570 OCCoreLocationTest[70030:a0f] Long: -122.00

The loc.coordinate is a CLLocationCoordinate2D struct.

 typedef struct {
     CLLocationDegrees latitude;
     CLLocationDegrees longitude;
  } CLLocationCoordinate2D;


MacRuby version:
framework 'corelocation'

loc = CLLocation.alloc.initWithLatitude(38.0, longitude:-122.0)
# => #<CLLocation:0x20004c4e0>

puts loc.class
# => CLLocation
puts loc.description
# => <+38.00000000, -122.00000000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2010-04-30 16:37:47 -0600
puts loc.horizontalAccuracy
# => 0.0
puts loc.verticalAccuracy
# => -1.0
puts loc.timestamp
# => #<__NSCFDate:0x20005ff40>
puts loc.coordinate
# => #<Boxed:0x2000af7a0>
puts loc.altitude
# => 0.0
puts loc.coordinate.longitude
# => Error:in `<main>': undefined method `longitude' for #<Boxed:0x2000b7660> (NoMethodError)






_______________________________________________
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

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel