Sunday, March 3, 2013

hotcocoa/mappings/appkit/box.rb:3:in `block': uninitialized constant CGRectZero (NameError)

Where does this error coming from?

So... after playing with RubyMotion, I start picking up MacRuby !
my goal was to build up some desktop utility apps and interactive desktop application taking various of gesture capturing input devices.

First, I tried out the hello world in XCode and it works fine. Then I tried writing Macruby apps without XCode. After I install macruby on rvm and run the Macruby apps generated by hotcoca, I saw this error:

hotcocoa/mappings/appkit/box.rb:3:in `block': uninitialized constant CGRectZero (NameError)


Troubleshooting in irb ?

Spent quite a lot of time checking documentation and setup instructions. When I tested the missing dependencies in irb, I found out that only those related to Cocoa UI are missing. So I load the cocoa framework explicitly and it works:

framework 'CocoaGraphic'
CRRectZero

Solve that in hotcocoa project

inside my application.rb, I load the framework explicitly before loading the hotcocoa gem:

begin
  # for OSX 10.8
  framework 'CoreGraphics'
rescue
end
framework 'Cocoa'

require 'rubygems' # disable this for a deployed application
require 'hotcocoa'



No comments:

Post a Comment