title: Xamarin iOS where are images from gallery
body: <p>I'm looking for a way to loop for each image that issaved on the iOS device.</p>
  
  <p>I have already tried with </p>
  
  <pre><code>var library = new ALAssetsLibrary();
  
  library.Enumerate(ALAssetsGroupType.Library, GroupEnumerator, Console.WriteLine);
  library.Enumerate(ALAssetsGroupType.Album, GroupEnumerator, Console.WriteLine);
  library.Enumerate(ALAssetsGroupType.SavedPhotos, GroupEnumerator, Console.WriteLine);
  library.Enumerate(ALAssetsGroupType.All, GroupEnumerator, Console.WriteLine);
  </code></pre>
  
  <p>But when I debug all list are empty.</p>
  
  <p>How can I retrieve a list of all images saved in the device (gallery)?</p>
  
  <p>Here are complet class code from where i (try to) list all images</p>
  
  <pre><code>using AssetsLibrary;
  using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Text;
  
  namespace AG.iOS.Services
  {
      public class iOSGalleryContent : IGalleryContent
      {
          public static readonly List&lt;string&gt; ImageExtensions = new List&lt;string&gt; { ".JPG", ".JPE", ".BMP", ".GIF", ".PNG" };
          List&lt;string&gt; ImagesNames = new List&lt;string&gt;();
          public List&lt;string&gt; GetImagesNames()
          {
              var library = new ALAssetsLibrary();
              library.Enumerate(ALAssetsGroupType.Library, GroupEnumerator, Console.WriteLine);
              library.Enumerate(ALAssetsGroupType.Album, GroupEnumerator, Console.WriteLine);
              library.Enumerate(ALAssetsGroupType.SavedPhotos, GroupEnumerator, Console.WriteLine);
              library.Enumerate(ALAssetsGroupType.All, GroupEnumerator, Console.WriteLine);
  
              return ImagesNames;
  
  
  
          }
  
          private void GroupEnumerator(ALAssetsGroup group, ref bool shouldStop)
          {
              if (group == null)
              {
                  shouldStop = true;
                  return;
              }
              if (!shouldStop)
              {
                  group.Enumerate(AssetEnumerator);
                  shouldStop = false;
              }
          }
  
          private void AssetEnumerator(ALAsset asset, nint index, ref bool shouldStop)
          {
              if (asset == null)
              {
                  shouldStop = true;
                  return;
              }
              if (!shouldStop)
              {
                  ImagesNames.Add(asset.AssetUrl.AbsoluteString);
                  Console.WriteLine(String.Format("Item[{0}] : {1}", index, asset.ToString()));
                  shouldStop = false;
              }
          }
      }
  }
  </code></pre>