Ronald Hofmann
Ronald Hofmann

Reputation: 1430

Objective-C strange appearance in debugger after stringByReplacingOccurrencesOfString

I´m on Mac OS X and Xcode 4.5.2 When executing these lines:

NSString *asSrcFileName = @"chromebar.png"
NSString *asSrcExtName  = @".png"
NSString *asTempName    = [asSrcFileName stringByReplacingOccurrencesOfString:asSrcExtName withString:@""];

I get a strange view of my variables in the debugger. See rectangle: enter image description here I expected asTmp to be @"chromebar" after line three. I´ve been using stringByReplacingOccurrencesOfString pretty often so far and have no idea what´s wrong. Somehow it looks like there is a unicode issue.

Anyone out there to shed some light on me?

Upvotes: 4

Views: 116

Answers (1)

Nikolai Ruhe
Nikolai Ruhe

Reputation: 81878

Are you inspecting asSrcTempName after the variable has been initialized (the green line showing the current execution point is below the initialization)?

Otherwise it's probably only uninitialized memory and lldb is showing garbage from a previous run.

I could not reproduce your problem in Xcode 4.5.1.

Upvotes: 2

Related Questions