0

I'm using Xamarin.ios to develop my app and need solution to one problem. I want to get the name of the image picked from the iPhone library, im using UIimagePickerController for picking the image. can anyone come up with the solution please.

public void Handle_FinishedPickingMedia (object sender, UIImagePickerMediaPickedEventArgs e)
{
    Console.WriteLine("Reference URL: [" + UIImagePickerController.ReferenceUrl + "]");

    NSUrl referenceURL =  e.Info[UIImagePickerController.ReferenceUrl] as NSUrl;
    Console.WriteLine ("" + referenceURL.LastPathComponent);
}

form Objective-C i have tried this code to get image name, but doesn't work!

Cœur
  • 37,241
  • 25
  • 195
  • 267
Sriramana
  • 43
  • 1
  • 5
  • http://stackoverflow.com/questions/4314405/how-can-i-get-the-name-of-image-picked-through-photo-library-in-iphone – Igor Sep 23 '15 at 11:07
  • @Igor, but i need the solution in xamarin – Sriramana Sep 23 '15 at 12:40
  • that's why it's just the comment. You can easy convert this code to c#. – Igor Sep 23 '15 at 13:04
  • assetsLibrary.AssetForUrl(referenceURL, (asset) => { if (asset != null) { var rep = asset.DefaultRepresentation; string name = rep.Filename; Console.WriteLine("name img {0}",name); } else { //tcs.TrySetResult(false); } }, (failure) => { //tcs.TrySetResult(false); } ); – Sriramana Sep 24 '15 at 09:51
  • i tried like this and worked out for me . thanks – Sriramana Sep 24 '15 at 09:51

0 Answers0