The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

billwright (10) [Avatar] Offline
#1
When I try to run the example from the source code, I get this error:

iMac27:Ruby bwright$ ruby helloMacRuby.rb
helloMacRuby.rb:3: syntax error, unexpected ':', expecting kDO_BLOCK
...SResizableWindowMask, backing: NSBackingStoreBuffered, defer...

The file looks like this:


framework 'cocoa'
app = NSApplication.sharedApplication
win = NSWindow.alloc.initWithContentRect([300,500,400,200], styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: NSBackingStoreBuffered, defer:false)


I'm running OS X Lion and installed MacRuby 0.10. And I also have XCode 4.3.1 installed and when I try to open up the XCode project it can't find the MacRuby.framework anywhere. Any ideas about this?

Thanks,
Bill
Jarc (1) [Avatar] Offline
#2
Re: First Cocoa example doesn't run for me
Bill, I copied your code and it worked fine for me. However, there is a lot of code missing in your example, so I suspect that the issue is further down in your code.

Also, Apple recently moved Xcode from /Developer to /Applications. Unfortunately, this probably broke MacRuby, so until MacRuby is updated to install using the new location, Xcode and MacRuby will be broken. smilie

I saw one suggestion to create a symlink, but that didn't work--at least not for me.