This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 54153 - Displaying UIImagePickerController fails to show camera feed
Summary: Displaying UIImagePickerController fails to show camera feed
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS (show other bugs)
Version: 2.3.4
Hardware: PC Windows
: --- critical
Target Milestone: ---
Assignee: Jimmy Garrido
URL:
Depends on:
Blocks:
 
Reported: 2017-03-28 21:40 UTC by tchadwick
Modified: 2017-03-31 00:12 UTC (History)
3 users (show)

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


Attachments
repro project (263.19 KB, application/x-zip-compressed)
2017-03-30 18:43 UTC, Jimmy Garrido
Details

Description tchadwick 2017-03-28 21:40:33 UTC
# Steps to reproduce
1. Create Xamarin Forms project using Xamarin.Forms pre-2.3.4.221-pre6.
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 2.3.3.193 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   4.3.0.784 (73f58d6)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

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

Xamarin.iOS and Xamarin.Mac SDK   10.4.0.123 (35d1ccd)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 1 Jimmy Garrido 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)
        {
            base.OnElementChanged(e);
            if (Control == null)
            {

                view = e.NewElement;
                cameraOverlayView.SetFrame(UIApplication.SharedApplication.KeyWindow.Frame);
                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 Garrido 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

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