Re: Synthesize NSMutableString retain count question
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