Welsh King
Welsh King

Reputation: 3238

Xamarin Forms - Camera and Image Picker doesnt work when using Modal Popup

I have a Xamarin forms app, that loads a camera and image selector, when I use it in a page they both work fine, however when I am in a page and then use a modal popup to display the same page the links to the camera / image selector does nothing.

I get this error in the Output window in Visual Studio

Warning: Attempt to present <UIImagePickerController: 0x1276b2400> on 
<Xamarin_Forms_Platform_iOS_PlatformRenderer: 0x128678400> whose view is 
not in the window hierarchy!

I am updated to 4.2.0.719 Xamarin and Xamarin.iOS 10.2.0.4

Anyone have any ideas to get around this in Xamarin Forms ?

I notice a post regarding iOS iOS 8 SDK: modal UIWebView and camera/image picker but this is not for Zamarin ?

Upvotes: 3

Views: 607

Answers (1)

jgoldberger - MSFT
jgoldberger - MSFT

Reputation: 6088

I recall having come across a similar issue before and filed a bug report: https://bugzilla.xamarin.com/show_bug.cgi?id=44500

Bug 44500 - A WebView that has a file picker control fails to show photo picker when page is pushed modally.

Description

A ContentPage with WebView that has a file picker control fails to show photo picker when ContentPage is pushed modally. This warning is displayed when the WebView tries to open the UIImagePickerController:

Warning: Attempt to present <UIImagePickerController: 0x7ba68800> on <Xamarin_Forms_Platform_iOS_ModalWrapper: 0x7e379c90> whose view is not in the window hierarchy!

Works as expected when page with WebView is pushed non-modally.

Upvotes: 1

Related Questions