Skip to content

Instantly share code, notes, and snippets.

@MilenPavlov
Created May 12, 2015 09:44
Show Gist options
  • Save MilenPavlov/493c26952da76bec4b87 to your computer and use it in GitHub Desktop.
Save MilenPavlov/493c26952da76bec4b87 to your computer and use it in GitHub Desktop.
SavePhotoToAppDirectory
private void SavePhotoToAppDirectory(NSData data)
{
var documentsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var jpgFilename = System.IO.Path.Combine(documentsDirectory,
$"Photo{DateTime.Now.TimeOfDay.Milliseconds}.jpg");
if (File.Exists(jpgFilename)) return;
NSError err = null;
if (!data.Save(jpgFilename, false, out err))
{
Trace(err.LocalizedDescription, false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment