Re: Trying to delete the first char of a string?
Re: Trying to delete the first char of a string?
- Subject: Re: Trying to delete the first char of a string?
- From: Fritz Anderson <email@hidden>
- Date: Mon, 29 Oct 2007 10:49:26 -0500
On 29 Oct 2007, at 10:25 AM, Bob Ueland wrote:
-(void) awakeFromNib
{
mstr=[NSMutableString stringWithString:@"Alabama"];
NSLog(@"%@",mstr);
// Delete first char
[mstr deleteCharactersInRange: NSMakeRange (0, 1)];
NSLog(@"%@",mstr);
}
Review Cocoa memory management. You initialize mstr with an
autoreleased instance of NSMutableString. mstr is good within
awakeFromNib, but once you get back to the run loop (as when you come
around to insertText:), it points to something that isn't an object
any more, and you crash.
— F
_______________________________________________
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