title: Saving a UIImage as a PNG, can't load image after restarting app
body: <p>I am using this to save a UIImage as a PNG</p>
  
  <pre><code>        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0];
      NSTimeInterval timeInMiliseconds = [[NSDate date] timeIntervalSince1970];
      NSString *generatedString = [NSString stringWithFormat:@"background%f.png", timeInMiliseconds];
      NSString  *pngPath = [documentsDirectory stringByAppendingPathComponent:generatedString];
      [UIImagePNGRepresentation(customBackground) writeToFile:pngPath atomically:YES];
  </code></pre>
  
  <p>I am saving pngPath into a plist from above then using the string in this:</p>
  
  <pre><code>UIImage *image = [UIImage imageWithContentsOfFile:string];
  </code></pre>
  
  <p>as string, the string shows up right and I can see the image file at the exact location it shows.</p>
  
  <p>Now the strange part is as long as I don't close the app the method works fine, but if I close and reopen the app the UIImage file just stays nil. Any thoughts?</p>