title: NSDocumentDirectory - write to & read from file
body: <p>This is the code used to write to a file from contents of <code>UITextFields</code> (name,addr,contactNumber,email).</p>
  
  <pre><code>NSDictionary *userDict = [NSDictionary dictionaryWithObjectsAndKeys:
                            self.name.text, @"UserName"
                            ,self.address.text, @"UserAddress"
                            ,self.contactNumber.text, @"UserContactNumber"
                            ,self.email.text, @"UserEmail"
                            , nil];
  NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:@"UserDetails"];
  BOOL writtenToFile = [userDict writeToFile:fullPath atomically:YES];
  NSLog(@"writtenToFile: %d",writtenToFile);
  </code></pre>
  
  <p>and this one to read from file. </p>
  
  <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *documentsPath = [paths objectAtIndex:0];
  NSDirectoryEnumerator *directoryEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:documentsPath];
  for (NSString *path in directoryEnumerator)
  {
      NSLog(@"File Names: %@", path);
      if ([path isEqualToString:@"UserDetails"]) {
          NSData *data = [NSData dataWithContentsOfFile:path];
          NSLog(@"%@",data);
          NSDictionary *userDict = [[NSDictionary alloc] initWithContentsOfFile:path];
          NSLog(@"%@",userDict);
      }
  }
  </code></pre>
  
  <p>But it is failing to read anything. All time it prints null in logs.</p>
  
  <pre><code>File Names: UserDetails
  (null)
  (null)
  </code></pre>