React-native-webview: Crash on file inputs with capture="camera"

Created on 13 Dec 2018  路  3Comments  路  Source: react-native-webview/react-native-webview

I have a web view, that contains a file input to upload files.
I I click the file input we get a crash.

   Source type must be UIImagePickerControllerSourceTypeCamera
       "4   libobjc.A.dylib                     0x0000000106ea8a97 _ZL15_objc_terminatev + 91",
       "5   Aktionsfinder                       0x0000000101644656 _ZL19CLSTerminateHandlerv + 355",
       "6   libc++abi.dylib                     0x000000010a5d165e _ZSt11__terminatePFvvE + 8",
       "7   libc++abi.dylib                     0x000000010a5d16d3 _ZSt9terminatev + 51",
       "8   libdispatch.dylib                   0x000000010a6dc55f _dispatch_client_callout + 28"

So I tried to find the problem and realized, that the crash only happens, when there is a capture="camera" attribute on the tag.

You can quickly try it yourselves by loading the following page in webview and clicking the "capture image" input and then selecting "Photo library", when you get the selector:
https://mobilehtml5.org/ts/?id=23

As soon as I remove the "capture" everything works fine.

Most helpful comment

@Titozzz I've found the problem yersterday and it was a mistake on my part.
I did not add the camera permission entry to Info.plist:

So to make it work, just add an Info.plist entry for camera usage:

         <key>NSCameraUsageDescription</key>
         <string>You can take photos to document your job.</string>

All 3 comments

@Titozzz I've found the problem yersterday and it was a mistake on my part.
I did not add the camera permission entry to Info.plist:

So to make it work, just add an Info.plist entry for camera usage:

         <key>NSCameraUsageDescription</key>
         <string>You can take photos to document your job.</string>

Thanks

Was this page helpful?
0 / 5 - 0 ratings