• 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
Re: Nested messages and void error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nested messages and void error


  • Subject: Re: Nested messages and void error
  • From: Enrique Zamudio <email@hidden>
  • Date: Fri, 17 Aug 2001 13:33:33 -0500
  • Organization: Nasoft

aStr = [[NSMutableString stringWithString: [aString string]]
appendString:
@"another string"];

+stringWithString: returns a string.
-appendString: returns void, so you can not assign it to anything.

You should do this:

aStr = [NSMutableString stringWithString: [aString string]];
[aStr appendString:@"another string"];

you can nest messages as long as they all return an object. the last one
must return something only if you're assigning it to a variable,
otherwise the last method can be void.

This is valid:

[[someString mutableCopy] appendString:@"another string"];

mutableCopy returns an object, which gets the message appendString:
which returns void.

eZL


  • Prev by Date: Re: Digital Librarian Replacement MTLibrarian
  • Next by Date: Fax capabilities?
  • Previous by thread: Re: Nested messages and void error
  • Next by thread: Drawers and Omniweb
  • Index(es):
    • Date
    • Thread