MacRuby - CLLocation Properties Not Accessible
- by Craig Williams
Anyone know why this works in Objective-C but not in MacRuby?
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];
// Results:
// 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
Here is the MacRuby version with results:
loc = CLLocation.alloc.initWithLatitude(38.0, longitude:-122.0)
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.respond_to?(:coordinate)
# => true
puts loc.coordinate.latitude
# => Error: unrecognized runtime type `{?=dd}' (TypeError)