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

4

6 回答 6

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.

于 2011-01-18T13:09:59.810 回答
1

如果您升级到 Xcode 4.3+,您将需要遵循以下说明:

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

它将为您带来 Macruby 项目模板并修复 rb_nibtool

于 2012-04-08T19:32:18.137 回答
1

如果您使用的是 XCode 4.1 或 4.2,则无需重新安装,就像我刚刚做的那样——它现在真的坏了。请参阅此票以了解何时修复,以及解决方法。

于 2011-07-25T21:51:56.703 回答
0

安装的 MacRuby 附带文件和项目模板以及允许 IB/Xcode 将 UI 元素链接到 MacRuby 代码的工具,反之亦然。在某些情况下,升级 Xcode 或安装 iOS SDK 会破坏 Xcode 桥,您需要重新安装 MacRuby。请注意,如果 Xcode4 仅在 MacRuby 0.10 或更高版本中受支持。(我今天刚刚在主干中编辑了 Xcode 4 模板,它们应该会在几天后发布 0.10 版本)。

于 2011-03-21T05:25:08.373 回答
0

如另一个答案所示,Xcode 4.1 有一个错误,即 IB 无法识别 MacRuby 类中的插座。它在 Xcode 4.2 中得到纠正。但是,如果升级到 4.2,则必须重新安装 MacRuby for MacRuby 插座才能重新开始工作。

于 2011-12-20T22:49:14.617 回答
0

此问题已在 Xcode 4.2 中解决。

于 2011-10-07T09:01:53.223 回答