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 ()
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)

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]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

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