When I click on choose file(input="file")
to choose an image from gallery , after select the image on android the app crash , and also on ios (iphone). I already add the permissions on the androidmanifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" />
and still not working.
I was getting the same issue in iOS. Try adding these data to info.plist
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>
For android can you share the logcat output.
If phonegap is used, can u share the id, I can take a look if you want
If you only targeting images, I suggest to use the Cordova / Ionic Native plugins instead of using the file input. It will be easier and you will get more control in accessing images and its properties. You can use either Camera plugin or Photo Library Plugin . You can use the requestAuthorization
function to request the permissions from the user.
You may need to add permissions inside your config.xml. For example, as mentioned in the Camera Plugin Ionic's page
[Warning] Since IOS 10 the camera requires permissions to be placed in your config.xml add
<config-file parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist"><string>You can take photos</string></config-file>
Please note that it is always the best idea to have all the permissions inside your config.xml file and not in the AndroidManifest.xml / info.plist, as it will always be added automatically once you add / run your build on the native platforms.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.