I'm using RubyMotion. The error message I see in Terminal is:
rake aborted! Command failed with status (1): [DYLD_FRAMEWORK_PATH="/Applications/Xcode.a...] /Library/RubyMotion/lib/motion/project.rb:101:in
block in <top (required)>' /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in
eval' /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `' Tasks: TOP => default => simulator
So the error is occurring in a file created by RubyMotion itself, not one of my files. Obviously I'm still at fault though. I have found the line that seems to trigger the error. Here's the relevant code of the UIViewController subclass that is creating the UIView and gradient:
def loadView
button1 = UIView.alloc.initWithFrame(CGRect.make(x:0, y:55, width:100, height:40))
gradientLayer = CAGradientLayer.layer
gradientLayer.colors = NSArray.arrayWithObjects(UIColor.redColor.CGColor, UIColor.greenColor.CGColor, UIColor.blackColor.CGColor, nil)
While more code comes later, I have found that its the gradientLayer.colors
line that causes the error. If I comment out that line and everything after it in loadView
, the error doesn't occur. Any idea what the problem is?
I've had trouble creating arrays using NSArray before. Try this:
def loadView
button1 = UIView.alloc.initWithFrame(CGRect.make(x:0, y:55, width:100, height:40))
gradientLayer = CAGradientLayer.layer
gradientLayer.colors = [ UIColor.redColor.CGColor, UIColor.greenColor.CGColor, UIColor.blackColor.CGColor ]
# ...
end