title: Problems selecting a photo or image from the cell phone
body: <p>I have a problem with views, when I open the camera and take the photo it sends me directly to the home screen, the same happens with an image of the gallery, this only happens with ios, since Android works without any problem. I would like to know what is happening because I have not found the error.</p>
  
  <pre><code>public async Task TakePicture()
          {
              await CrossMedia.Current.Initialize();
  
              if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
              {
                  await Application.Current.MainPage.DisplayAlert("Error", "No se encontro una cámara disponible.", "OK");
                  return;
              }
  
              var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
              {
                  SaveToAlbum = false,
                  CompressionQuality = 30,
                  PhotoSize = PhotoSize.Small
              });
  
              if (file == null)
              {
                  return;
              }
  
              byte[] array;
              using (var memoryStream = new MemoryStream())
              {
                  int count = 0;
                  file.GetStream().CopyTo(memoryStream);
                  array = memoryStream.ToArray();
                  while (count &lt; 10)
                  {
                      if (array.Count() == 0)
                      {
                          file.GetStream().CopyTo(memoryStream);
                          array = memoryStream.ToArray();
                          await Task.Delay(1000);
                      }
                      count++;
                  }
              }
  
              Stream stream = new MemoryStream(array);
              var image = ImageSource.FromStream(() =&gt; stream);
              FotoPerfil = image;
              User.Foto = array;
  
          }
  </code></pre>
  
  <p>This part is to take the photo directly from the cell phone, I have no problem opening the camera, the error comes when I choose that photo sends me to another screen, I do not know if it is closing and reopening the application but I do not know what happens.</p>
  
  <pre><code>public async Task PickPicture()
          {
              await CrossMedia.Current.Initialize();
              if (!CrossMedia.Current.IsPickPhotoSupported)
              {
                  await Application.Current.MainPage.DisplayAlert("Error",
                      "No se otorgaron permisos para accesar a las fotos.", "OK");
                  return;
              }
  
              var file = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions
              {
                  PhotoSize = PhotoSize.Medium,
                  CompressionQuality = 30,
  
              });
  
  
              if (file == null)
              {
                  return;
              }
              byte[] array;
              using (var memoryStream = new MemoryStream())
              {
                  int count = 0;
                  file.GetStream().CopyTo(memoryStream);
                  array = memoryStream.ToArray();
                  while (count &lt; 10)
                  {
                      if (array.Count() == 0)
                      {
                          file.GetStream().CopyTo(memoryStream);
                          array = memoryStream.ToArray();
                          await Task.Delay(1000);
                      }
                      count++;
                  }
              }
  
              await Application.Current.MainPage.DisplayAlert("Error", array.ToString(), "OK");
              User.Foto = array;
              Stream stream = new MemoryStream(array);
              var image = ImageSource.FromStream(() =&gt; stream);
              FotoPerfil = image;
          }
  </code></pre>
  
  <p>The latter is to select any image from the gallery, and exactly the same happens.</p>