7

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?

Kalle
  • 600
  • 5
  • 14
  • are you able to debug your app? if yes, can you give us some more detailed information about the crash? – beeef Sep 17 '14 at 19:19
  • This is just a regular UIWebView with a standard HTML file input. Nothing fancy. I am really surprised that this bug wasn't discovered in all the betas since it is breaking functionality for thousands of Apps. – Kalle Sep 17 '14 at 20:45
  • 1
    I'm experiencing the same issue, exactly the same as you. – Joel Jeske Sep 17 '14 at 22:07
  • 3
    To be more specific, if I build against iOS 7.1 and deploy on iOS 8 it crashes. If I build and deploy on iOS 8. It works as expected. – Joel Jeske Sep 17 '14 at 22:54
  • If you build against iOS 8, is it possible to run the App without problem on iOS 7.1? – Kalle Sep 18 '14 at 06:52

5 Answers5

2

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.

Kalle
  • 600
  • 5
  • 14
2

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

Community
  • 1
  • 1
Takide
  • 325
  • 2
  • 10
2

I had the same problem and discovered that adding the attribute multiple fixed the problem for me.

<input type="file" accept="image/*" multiple />
Riesling
  • 5,693
  • 6
  • 27
  • 30
2

I believe that it is not that apple has stopped supporting the <input> field on HTML at all. It is down to the developer not declaring that the app is using the following privacy elements in the plist (NSPhotoLibraryUsageDescription , NSCameraUsageDescription). please refer to the following page on stackoverflow NSPhotoLibraryUsageDescription in Xcode8

Basically I had the same problem but once I added these elements with a description everything work fine like nothing happened.

Community
  • 1
  • 1
A Bridge
  • 21
  • 2
  • @A Bridge: I am using the same privacy settings in plist file. Still having the issue. Any other idea you have? – Nitya Nov 04 '16 at 20:20
  • Other than make use there is a written description in each privacy in the right hand side column I try and keep digging around to find an answer. I'm constantly working on app if i see anything I will post here. – A Bridge Nov 11 '16 at 09:28
0

I had the same problem. The reason is a category, it has a method named pathExtension in my code, and the category covered the NSString(NSStringPathExtension). So I renamed the method, and now it's ok.

tversteeg
  • 3,579
  • 6
  • 36
  • 71