• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
A niceMessage in MyDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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?


  • Follow-Ups:
    • Re: A niceMessage in MyDocument
      • From: "Joshua D. Orr" <email@hidden>
    • Re: A niceMessage in MyDocument
      • From: "David W. Halliday" <email@hidden>
  • Prev by Date: Re: Sheets on sheets?
  • Next by Date: Re: Sheets on sheets?
  • Previous by thread: Re: Sheets on sheets?
  • Next by thread: Re: A niceMessage in MyDocument
  • Index(es):
    • Date
    • Thread