rubymotion-community / sugarcube

Some sugar for your cocoa. RubyMotion helpers.
Other
422 stars 66 forks source link

Sugarcube breaks pointer to CLLocationCoordinate2D struct #81

Closed kjf closed 11 years ago

kjf commented 11 years ago

I've just updated the gem from version 0.18.17 to the latest version and it seems something changed along the way to introduce an undefined method error when calling type on CLLocationCoordinate2D, i.e. when instantiating a pointer:

Pointer.new(CLLocationCoordinate2D.type, @locations.count)

This code results in: undefined method `type' for CLLocationCoordinate2D:Class (NoMethodError)

Reverting back to 0.18.17 fixes the issue.

colinta commented 11 years ago

I took a quick look, but couldn't reproduce. I'll try again tomorrow...

kjf commented 11 years ago

I'll try to knock together a quick sample project with the error.

colinta commented 11 years ago

I think you need to add app.frameworks << 'CoreLocation'. SugarCube adds methods to this class, but if it doesn't exist, it gets defined as a subclass of Object. Does CLLocationCoordinate2D.new(0, 0).latitude still work?

colinta commented 11 years ago

Weird, on a new project, and including the framework, I get this error, but on an existing project, I can run the code successfully. Well, I still think it is related to including the CoreLocation framework.

(main)> CLLocationCoordinate2D.new(0, 0).latitude
=> 0.0
(main)> CLLocationCoordinate2D.type
=> "{_CLLocationCoordinate2D=dd}"