• 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: Synthesize NSMutableString retain count question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Synthesize NSMutableString retain count question


  • Subject: Re: Synthesize NSMutableString retain count question
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 17 Feb 2010 08:22:54 -0600

On Feb 17, 2010, at 8:05 AM, Ryan Homer wrote:

> If you do reference a variable using dot notation, your accessors won't be used.

I think you meant the opposite.

[...]
>> However if I assign a value with
>>
>> [currentSection setString:@"Some value"];
>
> Here, you've not assigned anything. If currentSection is currently nil, that you are effectively doing:
>
> [nil setString:@"Some value"]
>
> which does nothing at all. You probably meant to do something like this:
>
> self.currentSection = [NSString string]; // allocate the memory for the string

You have to use NSMutableString if you're going to mutate it.

> [self.currentSection setString:@"Some value"]; // set the string to the allocated memory

Regards,
Ken

_______________________________________________

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

References: 
 >Synthesize NSMutableString retain count question (From: Philip Vallone <email@hidden>)
 >Re: Synthesize NSMutableString retain count question (From: Ryan Homer <email@hidden>)

  • Prev by Date: Re: Synthesize NSMutableString retain count question
  • Next by Date: Re: alternative to NSMatrix due to cell size restriction
  • Previous by thread: Re: Synthesize NSMutableString retain count question
  • Next by thread: Help with NSData dataWithContentsOfURL
  • Index(es):
    • Date
    • Thread