|
From: Jonathan P. <jp...@dc...> - 2005-06-14 07:02:04
|
On 13 Jun 2005, at 23:50, Dave Howell wrote:
> Sigh. I'm back. I'm staring at a misleading error message, and am
> mystified.
>
> /Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/
> osx/objc/oc_wrapper.rb:17:in `ocm_send':
> NSImage#initByReferencingFile: - methodSignature is nil.
> (OSX::OCMessageSendException)
>
> I *think* "methodSignature is nil" is somebody's (Cocoa?
> RubyCocoa?) way of saying "no method by that name found here."
Yes.
> Um? NSImage definitely has such a method. So something else is
> wrong. But I have no idea what it is. It can't find NSImage? I'm
> not asking for its method in the right way? I sent the wrong
> parameters, or the wrong type of parameters, or the wrong class of
> parameters, or the wrong number of parameters?
NSImage *instances* have such a method, but the NSImage *class* does
not. You can tell the difference in the Cocoa documentation because
class methods have a + at the beginning, and instance methods have a
- [*].
> @myImages = Array.new(6) {|i| NSImage.initByReferencingFile
> ("Image" + (i+1).to_s + ".gif")}
>
> My XCode project has files named "Image1.gif" "Image2.gif" . . .
> "Image6.gif" in it. The AppleScript version finds them as planned.
For this to work, you'd need to do NSImage.alloc.initByReferencingFile
(blahblah).
However, I there's also NSImage.imageNamed(blahblah) which should work.
[*] For example:
+ (id)imageNamed:(NSString *)name
- (id)initByReferencingFile:(NSString *)filename
|