title: How to write in a txt-file, iOS 7
body: <p>I'm trying to make an iPhone app, for iOS 7.
  I've created a txt file in my project, and want to be able to write the text from the txt file, when I push the write-button, write, and be able to read data, when I push the read-button, read.</p>
  
  <p>I'v found this method working, when I try to read data:</p>
  
  <pre><code>- (IBAction)load:(id)sender {
  NSString *filePath = [[NSBundle mainBundle] pathForResource:@"text" ofType:@"txt"];
  if (filePath) {
      NSString *stringFromFile = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
      [TextView setText:stringFromFile];
  }
  </code></pre>
  
  <p>}</p>
  
  <p>On another button, I want it to write data to the txt file in my project.
  I've tried a lot of methods, but no of really works - it simple won't write text in the file. 
  I've found one method, which works 50%. That means that it's not able to save the text I'm telling it to write, it only shows that it put's the text in the text box.</p>
  
  <p>code: </p>
  
  <pre><code>- (IBAction)write:(id)sender {
  
      NSString *documentsDirectory = [NSHomeDirectory()
                                      stringByAppendingPathComponent:@"Documents"];
  
      NSString *filePath = [documentsDirectory
                            stringByAppendingPathComponent:@"text"];
  
  
      //NSString *filePath = [[NSBundle mainBundle] pathForResource:@"text" ofType:@"txt"];
  
      NSString *printString = [NSString stringWithFormat:@"The new text"];
  
      [printString writeToFile:filePath atomically:NO encoding:NSUTF8StringEncoding error:nil];
  
      if (filePath) {
          NSString *stringFromFile = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
          [TextView setText:stringFromFile];
      }
  }
  </code></pre>
  
  <p>Can any one please help me out?
  Thanks in advance! :)</p>