title: NSKeyedArchiver not persisting data
body: <p>So, my app queries an Amazon Dynamo DB database and retrieves a few kilobytes worth of data. What I want the app to do is download everything the first time, and then every time after, just download a timestamp to see if it has the most recent version of the data. So that I only have to download the data every once in a while, I'm trying to use NSKeyedArchiver to archive the array that I'm downloading. I have tried this three different ways, and none of them work on an iPhone, although two of them work on the simulator.</p>
  
  <pre><code>[NSKeyedArchiver archiveRootObject:self.dataArray toFile:@"dataArray.archive"];
  </code></pre>
  
  <p>This does not work on the simulator nor the actual iphone. The result of this method is NO.</p>
  
  <p>The next thing I used was the full path:</p>
  
  <pre><code>[NSKeyedArchiver archiveRootObject:self.dataArray toFile:@"Users/Corey/Desktop/.../dataArray.archive"];
  </code></pre>
  
  <p>And this worked on the simulator, but not on the iPhone. My guess was that when compiled, the filesystem looks different (and obviously doesn't have the same path). So next I tried:</p>
  
  <pre><code>NSString *filePath = [[NSBundle mainBundle] pathForResource:@"dataArray" ofType:@".archive"];
  
  [NSKeyedArchiver archiveRootObject:self.dataArray toFile:filePath];
  </code></pre>
  
  <p>Once again, this works on the simulator but fails on the iphone. I have confirmed that all of the data is in self.dataArray before writing to the archive, and confirmed that the array is nil after writing back to the archive (in the iphone version). Any ideas what's going on? Is there a better way to do the filepath?</p>