rubycocoa - uninitalized constant NSObject

K

Kevin Lanik

I'm new to ruby and trying to embed it in some objective-c using
rubycocoa. I can get my .rb to run using

RBRubyCocoaInit();
NSString *path = [[NSBundle mainBundle] pathForResource:mad:"xyz"
ofType:mad:"rb"];
NSString *fileContents = [NSMutableString
stringWithContentsOfFile:path];
[RBObject RBObjectWithRubyScriptString:fileContents];

This works just fine, but I'm getting strange errors if I want to use
any NSObjects. The odd part is that NSLog still works from inside ruby.
If i put OSX::NSLog("xyz"), I get xyz on the console like I should. If
i put myObject = OSX::NSObject.alloc.init I get the error
uninitialized constant OSX::NSObject
If I try to require 'osx/cocoa' the app crashes (it doesn't even catch
in my ruby exception handling) What am I missing?
Thanks,
Kevin
 
C

Charles Steinman

Kevin said:
If i put OSX::NSLog("xyz"), I get xyz on the console like I should. If
i put myObject = OSX::NSObject.alloc.init I get the error
uninitialized constant OSX::NSObject
If I try to require 'osx/cocoa' the app crashes (it doesn't even catch
in my ruby exception handling) What am I missing?
Thanks,
Kevin
Does it work to require 'osx/cocoa' within IRB? It sounds like your
RubyCocoa install may be bad (though in that case it seems kind of
strange that it works as well as it does).
 
K

Kevin Lanik

Does it work to require 'osx/cocoa' within IRB? It sounds like your
RubyCocoa install may be bad (though in that case it seems kind of
strange that it works as well as it does).

Yes, I can do this within IRB, or running the .rb with ruby from the
command line. I think the problem may have to do with codewarrior
somehow... I'm going to try a test in XCode to see if it persists, I'll
post again with what I find.
 
K

Kevin Lanik

Yes, I can do this within IRB, or running the .rb with ruby from the
command line. I think the problem may have to do with codewarrior
somehow... I'm going to try a test in XCode to see if it persists,
I'll post again with what I find.

Looks to be the framework after all. #import <RubyCocoa/RubyCocoa.h> in
XCode won't even compile, complaining it can't find config.h &
defines.h for osx_ruby.h. I guess it's back to the install phase...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[ANN] RubyCocoa 0.11.0 3
RubyCocoa LoadError 0
[ANN] RubyCocoa 0.11.1 0
[ANN] RubyCocoa 0.13.0 0
[ANN] RubyCocoa 0.13.2 0
RubyCocoa Web Services 1
[ANN] RubyCocoa 0.10.0 Developer Preview 0
[ANN]RubyCocoa 0.4.2 0

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top