(iOS8) UIWebView and Input Tag, Type=File Crashes Application

Joshua_DJoshua_D USMember ✭✭

I have a simple UIWebView project as a test bed to see how I can utilize the file type input tag for uploading a local file from an iOS device to a server. I have seen a functioning demo here (https://longhandpixels.net/demos/mobilesafari-ios6/), if I navigate to this site on an iPad, I am able to select an image or video (as well as launch the camera app). However, when I apply the same basic HTML into a test file and add it into my application, it crashes the app when I select the "Choose file" button. What would be the difference between Safari and UIWebView in this case that would cause it to crash? I though that the UIWebView was a containerized version of Safari?

Best Answer

Answers

  • Joshua_DJoshua_D USMember ✭✭

    Attached is a copy of my demo project that I've been messing around with. Feel free to pull it down and have a look.

  • Joshua_DJoshua_D USMember ✭✭

    Thanks @adamkemp, that seems to have resolved the issue in this test project. As you could probably tell by the simplicity and code commented out everywhere, this is just a test project to prototype out ideas. The code that you had me remove was due to some previous design and testing and I failed to clean up after myself in the project.

    Though I do not need the PresentViewController method in this project, that was a attempt at a work around for an iOS8 bug where if a user selects/taps on a drop-down menu in a UIWebView too quickly/often, then it will cause an unhandled exception and crash the application. I can't recall now what the exception is, but this was an attempted work around to restrain the WebView so that the order of Dismissing and Presenting the ViewController stayed in the correct order.

  • adamkempadamkemp USInsider, Developer Group Leader mod

    If you can reproduce the original issue then try posting an example of that, and maybe I can suggest a better workaround.

Sign In or Register to comment.