title: Rear camera is not working in Ipad in Xamarin Forms App... due to style config?
body: <p>Using @JamesMontemago Xam.Plugin.Media I get the same error as another post, but the answer does not apply to me. In short the rear camera works on all devices bar the ipad. Have tried on many physical devices and it is always the Ipads that crash. On the Ipads, front camera works great, but calling the rear camera causes it to crash.</p>
  
  <p>Unfortunately, the use of the back camera is absolutely vital, the app takes photos of wine bottles, and wine bottles, to my extensive knowledge on emptying them, do not possess the ability to take selfies.</p>
  
  <p>The similar post is:</p>
  
  <p><a href="https://stackoverflow.com/questions/43185839/rear-camera-is-not-working-in-ipad-in-xamarin-forms-app">Rear camera is not working in Ipad in Xamarin forms App</a></p>
  
  <p>For that post, the solution was found in:</p>
  
  <p><a href="https://github.com/jamesmontemagno/MediaPlugin/issues/173" rel="nofollow noreferrer">https://github.com/jamesmontemagno/MediaPlugin/issues/173</a></p>
  
  <p><a href="https://stackoverflow.com/questions/41256528/application-freezes-when-trying-to-present-rear-camera-on-ipad">Application freezes when trying to present rear camera on iPad</a></p>
  
  <p>This post and one other refer to UI configuration code in the AppDelegate file that was causing the camera to throw a wobbly. In that case it was the inclusion of:</p>
  
  <pre><code> UISlider.appearance().minimumTrackTintColor = themeUI.PrimaryColor.withAlphaComponent(100)
  </code></pre>
  
  <p>that was causing the crash by throwing an invalid context error when, during the drawing of the camera, the CoreGraphics library called:</p>
  
  <pre><code>[UISlider setMinimumTrackTintColor];
  </code></pre>
  
  <p>I have been through my files and can find no such configuration change to the UISlider at all, so this solution does not help me unfortunately.</p>
  
  <p>The code bugs at the "var file =" line of the following code:</p>
  
  <pre><code>takePhoto.Clicked += async (sender, args) =&gt;
          {
              if (!CrossMedia.Current.IsCameraAvailable || 
  !CrossMedia.Current.IsTakePhotoSupported)
              {
                  await DisplayAlert("No Camera", ":( No camera available.", 
    "OK");
                  return;
              }
  
              var file = await CrossMedia.Current.TakePhotoAsync(new 
  Plugin.Media.Abstractions.StoreCameraMediaOptions
              {
                  Directory = "Test",
                  SaveToAlbum = true,
                  CompressionQuality = 25,
                  CustomPhotoSize = 100,
                  PhotoSize = PhotoSize.MaxWidthHeight,
                  MaxWidthHeight = 200,
                  DefaultCamera = CameraDevice.Front,
                  Name = $"{DateTime.UtcNow}.jpg",
  
  
              });
  
  
              if (file == null)
                  return;
  
              await DisplayAlert("File Location", file.Path, "OK");
  
              image.Source = ImageSource.FromStream(() =&gt;
              {
                  var stream = file.GetStream();
                  file.Dispose();
                  return stream;
              });
          };
  </code></pre>
  
  <p>Running a stack trace by putting a breakpoint of this line and bringing up the call stack window when it was hit unfortunately just gave me:</p>
  
  <p>"condition `array->len == 1' not met SIGABRT error"</p>
  
  <p>So no help there.</p>
  
  <p>HOWEVER!</p>
  
  <p>I am using GrialKit to help with the UI config side of things and I am wondering whether there is anything in that kit that configures sliders and therefore interferes with the back camera.</p>
  
  <p>So my question is: </p>
  
  <p>Using code-behind file of the XAML page where the camera appears, can I in any way reset the UI configuration to some kind of Xamarin Forms standard for that page? By that I mean kill any UI configuration that may be going on unnoticed?</p>
  
  <p>Any guidance much appreciated </p>