Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
AppDelegate.cs
Camera.cs reorganizing files into recipes folder Mar 7, 2018
ImageView.csproj reorganizing files into recipes folder Mar 7, 2018
ImageView.sln reorganizing files into recipes folder Mar 7, 2018
ImageViewController.cs reorganizing files into recipes folder Mar 7, 2018
Info.plist reorganizing files into recipes folder Mar 7, 2018
Main.cs reorganizing files into recipes folder Mar 7, 2018
README.md

README.md

id title brief samplecode sdk
3ED7298A-1B29-EBAE-2203-F2F4919A8221
Save Photo to Album with Metadata
This recipe shows how to save a photo to the Photos Camera Roll Album, including image metadata.

Recipe

The sample code uses the  Camera helper from TweetStation to take a picture, then demonstrates how to save it (with metadata) in the completion handler:

TweetStation.Camera.TakePicture (this, (obj) =>{
    var photo = obj.ValueForKey(new NSString("UIImagePickerControllerOriginalImage")) as UIImage;
    var meta = obj.ValueForKey(new NSString("UIImagePickerControllerMediaMetadata")) as NSDictionary;
    ALAssetsLibrary library = new ALAssetsLibrary();
    library.WriteImageToSavedPhotosAlbum (photo.CGImage, meta, (assetUrl, error) =>{
        Console.WriteLine ("assetUrl:"+assetUrl);
    });
});;

Additional Information

There is a simpler mechanism to save an existing UIImage to the Photo Album, but it does not include metadata:

var someImage = UIImage.FromFile("someImage.jpg");
someImage.SaveToPhotosAlbum((image, error) => {
    var o = image as UIImage;
    Console.WriteLine("error:" + error);
});