7

I am trying to get a basic hello world application going using XCode and Interface Builder. However, in Interface Builder I can't see my outlets to wire things up with. I go to the connections tab of the objects inspector pane and it says "New Referencing Outlet".

I am wondering if my code is wrong. Here it is

class HelloWorldController 
    attr_accessor :hello_label, :hello_button, :hello

    def awakeFromNib 
        @hello = true
    end

    def changeLabel(sender) 
        if @hello
            @hello_label.stringValue = "Good Bye" 
            @hello_button.title = "Hello" 
            @hello = false
        else
            @hello_label.stringValue = "Hello World" 
            @hello_button.title = "Good Bye" 
            @hello = true
        end 
    end
end

As I understand it I should be able to see hello, hello_label, hello_button, and changeLabel, but I don't. I thought maybe I had a misspelling somewhere, but that doesn't seem to be it either. Here is a shot of the two interface builder windows.

alt text

Any help is appreciated. I think I am just overlooking something, but not sure.

UPDATE: I solved the problem by just re-installing OS X. I suspect there was a problem because X Code 4 was installed, no idea. However, it now works with a fresh install of OS X, X Code and MacRuby

Buddy Lindsey
  • 3,560
  • 6
  • 30
  • 42
  • That looks correct to me. I assume you've saved the source file? Also, try 'build clean' and restart Interface Builder. – Stephen Petschulat Jan 03 '11 at 19:17
  • I have saved the project. In fact I saved the project and rebooted the computer then re-opened it. I just opened it back up and did a clean then a build. Then opened up in interface builder and same problem. I tried removing and adding new NSObject and still same problem. – Buddy Lindsey Jan 03 '11 at 19:22

6 Answers6

1

If you upgrade to Xcode 4.3+, you will need to follow these instructions:

http://lldong.github.com/blog/2012/03/05/xcode-4-dot-3-macruby-compatible-problem-workaround/

It will bring bace your Macruby project templates and fix rb_nibtool

colinta
  • 3,536
  • 1
  • 28
  • 18
1

I had a similar problem http://www.mail-archive.com/macruby-devel@lists.macosforge.org/msg05331.html

it was fixed by reinstalling MacRuby after a reinstall of XCode.

ian
  • 12,003
  • 9
  • 51
  • 107
1

No need to reinstall if you are on XCode 4.1 or 4.2, like I just did - it is truly broken now. See this ticket for when it is fixed, and a workaround.

Magnar
  • 28,550
  • 8
  • 60
  • 65
0

MacRuby installed comes with file and project templates and a tool that allows IB/Xcode to link UI elements to MacRuby code and vice-versa. In some cases, upgrading Xcode or installing the iOS SDK breaks the Xcode bridge and you need to reinstall MacRuby. Note that if Xcode4 is only supported in MacRuby 0.10 or more recent. (I just edited the Xcode 4 templates today in trunk and they should go out with the 0.10 release in a few days).

Matt Aimonetti
  • 1,112
  • 1
  • 10
  • 11
  • That is good to know. However, in this original problem I did re-install macruby and it never fixed it until I did a fresh install of OS X and xcode 4 was actually gone. – Buddy Lindsey Mar 22 '11 at 08:57
0

This issue has been resolved in Xcode 4.2.

p4010
  • 943
  • 7
  • 19
0

As indicated in another answer, Xcode 4.1 had a bug where IB did not recognize outlets in MacRuby classes. It is corrected in Xcode 4.2. However, if you upgrade to 4.2, you must then reinstall MacRuby for MacRuby outlets to start working again.

Sean DeNigris
  • 6,306
  • 1
  • 31
  • 37