Xamarin.ios Input=file not working in WKWEBVIEW

This is my first post and let me preface this with I am bit of a beginner but I need some help (and hopefully quickly) on a problem I am having.

I have a web page/app that uses the input element to open the camera on a user's device, take a picture and display a preview of that image...the eventually that image is sent via API to a server. This whole process works fine within Safari on a mobile device...however, within a WKWEBVIEW, it does not. If I run the same page within the WKWEBVIEW, when the user opens the input element, the camera opens and the user can take a picture however, that is where it ends. The image is never displayed in the preview or held in the FILES object of the input.

Just for some background, the INPUT element on the web page is like follows:

      input type="file" id="image_uploads" name="image_uploads" accept="image/*" capture="camera"

and in case it means anything, here is how the xamarin code is working to open the URL (where WebViewVolume is the WKWEBVIEW):

public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
var url = [URL HERE]
WebViewVolume.LoadRequest(new NSUrlRequest(new NSUrl(url)));
}

I know there are issues around javascript and accessing items on a webpage from the xamarin code, but that is not what I am trying to do here.

Does anyone have any experience in using the INPUT element to capture images from within a web page, that is loaded from a WKWEBVIEW?

Thanks for any help!

Tagged:

Posts

  • AdrianGhiAdrianGhi USMember ✭✭

    <key>NSCameraUsageDescription</key> <string>Allow the app to control Camera</string> <key>NSPhotoLibraryUsageDescription</key> <string>This app needs access to photos.</string> <key>NSMicrophoneUsageDescription</key> <string></string>

    Don't forget to add the permissions!

Sign In or Register to comment.