How to change NSString value while debugging in Xcode?

You can do this in the debug console. Say you have NSString* myVar. In the console, after (gdb), type set myVar = @"My new string". If you are using (lldb), then use the equivalent expression expr myVar = @"My new string" instead.

This may not show up correctly in the variables panel, but you can verify the value by entering po myVar into the console. Your code should pick up the new value.

For some great info about using expr, check out this StackOverflow post.

Leave a Comment