A niceMessage in MyDocument
A niceMessage in MyDocument
- Subject: A niceMessage in MyDocument
- From: Ivan Myrvold <email@hidden>
- Date: Wed, 20 Jun 2001 00:30:57 +0400
My next dumb question to this group, for my Document Based application:
In MyDocument.h I have:
- (NSString *)niceMessage;
In MyDocument.m I have:
- (NSString *)niceMessage {
return @"Nice Greeting!";
}
In MyWindowController.m in one of my methods:
NSLog(@"The Message: %@", [[self document] niceMessage]);
The compiler complaints about the above, saying:
warning: cannot find method (pointing to the NSLog line).
warning: return type for 'niceMessage' defaults to id (for the same
line)
And running the application, I get the following in the console:
The Message: (null)
The documentation says:
As a convenience, the Objective-C language also supports the @"..."
construct to create ....
Such an object is created at compile time and exists throughout your
program's execution. The compiler makes such an object constants unique
on a per-module basis, and they're never deallocated (though you can
retain and release them as you do any other object).
So why does I get a null in the console, and what about the compiler
complaints?