Bug 54153 - Displaying UIImagePickerController fails to show camera feed
Summary: Displaying UIImagePickerController fails to show camera feed
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS (show other bugs)
Version: 2.3.4
Hardware: PC Windows
: --- critical
Target Milestone: ---
Assignee: Jimmy [MSFT]
Depends on:
Reported: 2017-03-28 21:40 UTC by tchadwick
Modified: 2017-07-05 07:40 UTC (History)
4 users (show)

See Also:
Tags: ios, UIImagePickerController, alert
Is this bug a regression?: ---
Last known good build:

repro project (263.19 KB, application/x-zip-compressed)
2017-03-30 18:43 UTC, Jimmy [MSFT]

Description tchadwick 2017-03-28 21:40:33 UTC
# Steps to reproduce
1. Create Xamarin Forms project using Xamarin.Forms pre-
2. Create either a custom renderer or Dependency service that presents a UIImagePickerController on the foremost presented UIViewController.
3. Add code to invoke step 2 from PCL shared project.
4. Run (I tested on an iPad, and simulator is unavailable for this test)

# Expected behavior
In the stable the camera feed is displayed with a corresponding overlay.

# Actual behavior
Blank white screen.

# Supplemental info (logs, images, videos)

# Test environment (full version information)
Visual Studio 2017 Latest Xamarin packages on both windows and mac machines.
Microsoft Visual Studio Professional 2017
Version 15.0.26228.9 D15RTWSVC
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Professional

Visual Studio Tools for Universal Windows Apps   15.0.26228.00
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin (73f58d6)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK (9578cdc)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK (35d1ccd)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 1 Jimmy [MSFT] 2017-03-28 22:10:42 UTC
Thank you for filing this report!

This might be related: https://github.com/jamesmontemagno/MediaPlugin/issues/186
Are you invoking the UIImagePickerController from an ActionSheet?
Comment 2 tchadwick 2017-03-29 17:52:14 UTC
@Jimmy Garrido,
You are totally correct, it is the same issue.  I use the following code to present the UIImagePickerController (inside a custom renderer):

protected override void OnElementChanged(ElementChangedEventArgs<CameraView> e)
            if (Control == null)

                view = e.NewElement;
                currentUIViewController = GetCurrentUIController();
                currentUIViewController.PresentModalViewController(pickerController, false);

private UIViewController GetCurrentUIController()
            UIViewController currentController = UIApplication.SharedApplication.KeyWindow.RootViewController;
            while (currentController.PresentedViewController != null)
                currentController = currentController.PresentedViewController;
            return currentController;
Comment 3 Jimmy [MSFT] 2017-03-30 18:43:29 UTC
Created attachment 21079 [details]
repro project

I'm attaching the Media Plugin sample as a repro project. I've also opened a PR for a fix: https://github.com/xamarin/Xamarin.Forms/pull/848

### Steps to Reproduce
1. Run the attached iOS project
2. Press "Pick Photo"
3. Press "Okay" in the alert

### Expected Results
The UIImagePickerController will be presented

### Actual Results
The UIImagePickerController is not presented
Comment 4 Rui Marinho 2017-03-31 00:12:55 UTC
Should be fixed on 2.3.5-pre1
Comment 5 Neha Kharbade 2017-07-05 07:40:05 UTC
Verified this bug on Simulator & device for xamarin.forms

For both its working as expected.

gist link: https://gist.github.com/nehaKh/ea8a3b090d27c83f35bccf0d529bbeed

Note You need to log in before you can comment on or make changes to this bug.