title: Writing into a file residing in Xcode project directory
body: <p>I am currently writing code that writes data (data is generated from an HTTP response) to an xml file that resides in the Xcode project directory (Application bundle).Unfortunately I wasn't able to write into an xml file that resides in the Xcode project, So, I tried the same code and I just modified the file path to point to an xml file that resides in the desktop (I choose a different location in order to investigate the issue further) and surprisingly it worked where a simple string is written to the xml file. I read some posts saying that we can't write to a file in the App bundle as there is a limitation in this aspect for the Iphone. Is that true ? And if so, is there any alternative. I would really appreciate if anyone has an insight on this issue and could help. Note that I declared an error variable and tried to see if I can log any error message, but the debugger didn't enter the if statement (and hence no writing error is caught). Below is the sample code that I wrote:</p>
  
  <pre><code>//writing to a file
    NSString *file_path = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"xml"];
    NSString *dummy = @"Hello World!!\n"; 
    NSFileManager *filemanger;
    NSError *writingError = nil;
    filemanger = [NSFileManager defaultManager];
  
    if ([filemanger fileExistsAtPath:file_path] == YES)
      NSLog (@"File do exist!!!");
    else
      NSLog (@"File is not found!!!");
  
  
  BOOL sucess = [dummy writeToFile:file_path atomically:YES encoding:NSUnicodeStringEncoding error:&amp;writingError];
  if(!sucess)
  {
      NSLog(@"Unable to write to the file");
  }
  
  if (writingError) {
      NSLog(@"Fail: %@", [writingError localizedDescription]);
  }
  </code></pre>