On Aug 17, 2010, at 2:03 PM, James Miller <jmiller3...@gmail.com> wrote:

> Hello.
> 
> I'm a little new to Objective-C / Cocoa so please don't shoot me, but I've 
> been looking around for a few hours and can't seem to figure out what I'm 
> doing wrong on my own and could use a second/third/fourth set of eyes.
> 
> I have NSTimer that runs several times a second against an NSString called 
> level,  which is 190 characters long and previously initialized from:
> 
> // NSString *level = [[NSString alloc]
> //                                             initWithContentsOfFile:path
> //                                             encoding:NSUTF8StringEncoding
> //                                             error:&error];
> 
> 
> During the timer call, the level NSString is modified by the following line 
> of code:
> 
> level=[level stringByReplacingCharactersInRange:NSMakeRange(5,1) 
> withString:@" "];

You don't own the resulting string and it's probably getting autoreleased by 
the next time you're in the timer. You'll need to retain the result of 
stringByReplacingCharactersInRange. 

> 
Dave Carrigan
Seattle, WA_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to