Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8.0 UIWebView file input crashes my App

After updating to iOS 8.0 clicking the "Choose file" button (HTML file input) and then clicking "Take photo or Video" / "Choose Existing" crashes my App.

This functionality has been working perfectly fine since iOS 6 but in iOS 8.0 the file input functionality is completely broken!

Do any one else experience the same problem with there UIWebView Apps?

like image 253
Kalle Avatar asked Sep 17 '14 19:09

Kalle


2 Answers

The solution to this problem is as Joel Jeske writes, you have to rebuild your App against iOS 8. This is the only solution to this problem. Rebuilding against iOS 8 will also make the App run on iOS 7/6 without any problem.

like image 130
Kalle Avatar answered Sep 24 '22 22:09

Kalle


I was having a similar issue, and I have discovered that the UIWebView elements in IOS do not support the html element:

<input type="file">

I am not sure why Apple chose to not support this IMPORTANT html element, but I am sure they have their reasons. (Even though this element works perfectly on Safari on IOS.)

In many cases, when the user clicks this kind of button in a UIWebView, it will let them take/ choose a photo. HOWEVER, the UIWebView in IOS does not have the capability to attach files like this into the POST data when the form is submitted.

The Solution: To accomplish the same task you can create a similar form in InterfaceBuilder with a button that triggers the UIImagePickerController. Then, you create you an HTTP POST request with all of the form data and the image. It isn't as hard as it sounds, check out the link below for some sample code that gets the job done: ios Upload Image and Text using HTTP POST

like image 24
Takide Avatar answered Sep 25 '22 22:09

Takide