title: iOS: read raw plist
body: <p>I want to read the UserDefaults plist but not as Dictionary or Data. I want it as string like it is when you open it with an editor.</p>
  
  <pre><code>NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  NSString *homeDir = [documentsPath stringByReplacingOccurrencesOfString:@"Documents" withString:@""];
  NSString *defaultsPath = [homeDir stringByAppendingString:[NSString stringWithFormat:@"Library/Preferences/%@.plist", [[NSBundle mainBundle] bundleIdentifier]]];
  NSData *data = [NSData dataWithContentsOfFile:defaultsPath];
  </code></pre>
  
  <p>Already tried:</p>
  
  <pre><code>`NSString *contents = [NSString stringWithContentsOfFile:defaultsPath encoding:NSUTF8StringEncoding error:&amp;error];
  </code></pre>
  
  <p>which ends up with </p>
  
  <blockquote>
    <p>The operation couldn’t be completed. (Cocoa error 261.)</p>
  </blockquote>