title: Error when using "setValue: forKey:" on an NSString's isa pointer then calling [string class]
body: <p>Heres's what I've got as to error. </p>
  
  <pre><code>libobjc.A.dylib`_objc_trap():
  0x14c13f4:  pushl  %ebp
  0x14c13f5:  movl   %esp, %ebp
  0x14c13f7:  ud2    
  </code></pre>
  
  <p>So basically I'm trying to understand How <code>NSString</code> works and trying to find a way to change the pointer that points to "real (char *) string" which is said to be a constant.</p>
  
  <p>So, I found there is a pointer called isa which points to (<code>__NSCFConstantString *</code>).
  It led me to think that if I change that pointer then I could change the string. </p>
  
  <p>The code I tried was this:</p>
  
  <pre><code>NSString *st3 = [[NSString alloc] initWithString:@"hihi"];
  [st3 setValue:@"change" forKey:@"isa"];
  </code></pre>
  
  <p>And, the result showing that </p>
  
  <p><strong>Before:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/6XwdG.png" alt="enter image description here"></p>
  
  <p><strong>After:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/eBjEi.png" alt="enter image description here"></p>
  
  <p>It seems changed but it changed every <code>NSString</code> object that has @"hihi" string.</p>
  
  <p>And then what I did was <strong>[st3 class]</strong> hoping it will give the <code>isa</code> pointer then I got that error message posted on the top.</p>
  
  <p>Could you anyone explain what's going on and why it behaves like this?
  And, it there any way to intern (i'm not so sure about the term) like in Java? </p>
  
  <p>Please avoid saying just use "NSMutableString" I'm just trying to figure it out seeing there might be some way to do it.</p>