title: How to encode and decode NSString in iOS?
body: <p>I am developing an app which should support iOS5,iOS6,iOS7.</p>
  
  <p>In my app i want to encode my <code>NSString</code> Data using <code>base64encoding</code>.</p>
  
  <p>Following is the code I am using for encoding</p>
  
  <pre><code>NSString *userData = @"data";
  NSString *base64EncodedString = [[userData dataUsingEncoding:NSUTF8StringEncoding] 
  base64EncodedStringWithOptions:0];
  </code></pre>
  
  <p>The above code is running fine in iOS7, but in iOS6 the application crashes,with the following error:</p>
  
  <pre><code>[NSConcreteMutableData base64EncodedStringWithOptions:]
  </code></pre>
  
  <p>Is there any other way to encode data Or any function which support iOS6 &amp; iOS7.</p>
  
  <p>Can anyone help me out with this?</p>
  
  <p>Thanks in Advance</p>