NSString copy not copying?

Posted by Scotty Allen on Stack Overflow See other posts from Stack Overflow or by Scotty Allen
Published on 2010-03-26T06:30:46Z Indexed on 2010/03/26 6:33 UTC
Read the original article Hit count: 452

Filed under:
|
|
  NSString *myString = @"sample string";
  NSString *newString = [NSString stringWithString: myString];

If I set a breakpoint after these two lines, the pointer for myString is the same as the pointer for newString.

WTF? Isn't NSString copy supposed to return a pointer to a new object? Or am I missing something fundamental about how copy is supposed to work?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone