title: Can I set arbitrary attributes to file in iOS?
body: <p>I'm implementing some code that manages simple files (like text files), and I would like to add some information to the file, like, for example, location, tags, etc, without writing extra text on the text file.</p>
  
  <p>I think that the easiest way to do this would be to add extra info to the file attributes, but I'm not sure if that is possible.</p>
  
  <p>I've been playing with NSURL's <code>setResourceValue:forKey:error:</code>, but it seems that only the NSURL's predefined keys actually write something to the attributes of the file. So:</p>
  
  <pre><code>NSURL *fileURL; //suppose this points to something
  NSError *error;
  id resourceValue;
  
  [fileURL setResourceValue:@"recorded string" forKey:@"testingkey" error:&amp;error];
  [fileURL getResourceValue:&amp;resourceValue forKey:@"testingkey" error:&amp;error];
  </code></pre>
  
  <p>In the code above, both functions <code>setResourceValue:forKey:error:</code> and <code>getResourceValue:forKey:error:</code> return <code>YES</code> meaning they were successful, but the final value of <code>resourceValue</code> is nil, which might mean that the value was actually not recorded.</p>
  
  <p>So, is there a way of setting my own attributes to files in iOS? If not, what would be a good (easy) way of assimilating extra information to files, without modifying the files themselves?</p>
  
  <p>Thanks a lot!</p>