• 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: what am I missing with NSString ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what am I missing with NSString ?


  • Subject: Re: what am I missing with NSString ?
  • From: Jeffrey Oleander <email@hidden>
  • Date: Tue, 26 May 2009 12:44:02 -0700 (PDT)

> On Tue, 2009/05/26, Volker in Lists <email@hidden> wrote:
> From: Volker in Lists <email@hidden>
> Subject: Re: what am I missing with NSString ?
> To: "vinai" <email@hidden>
> Cc: email@hidden
> Date: Tuesday, 2009 May 26, 08:41
> from the code listed I cannot tell if you alloc'ed memory
> for your NSString at all?
>
> What is the goal you try to achieve? If you just want to
> store a single file path... with a global NSString do as
> along the lines of:
>
> [rawFileName release];
> rawFileName = [[NSString alloc] initWithString:[[files
> objectAtIndex:i] stringByStandardizingPath]]];

The NSString reference suggests that it will return an
object.  Since it's an instance method and not a class
method, this suggests that an alloced string must be
the receiver.

"Returns an NSString object initialized by copying
 the characters from another given string.
- (id)initWithString:(NSString *)aString
"

OTOH, stringWithString is a class method, suggesting
that it must be sent to NSString and it will take
care of the alloc:

"Returns a string created by copying the characters
 from another given string.
+ (id)stringWithString:(NSString *)aString
"





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Adding a Timer to a Thread
  • Next by Date: Re: Adding a Timer to a Thread
  • Previous by thread: Re: what am I missing with NSString ?
  • Next by thread: [OT] default boot device
  • Index(es):
    • Date
    • Thread