Input type file in webview - Xcode

0

I created a webview of a page that contains an input type file to upload photos, however, in the webview of the Iphone, when I click the button to upload the photo, it opens a menu only with the option "Photos of the gallery", and does not give the option of the camera. Searching the internet I saw that I need to release the camera access and the photo gallery through the file info.plist. Entering Keys to release camera and gallery

<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>

When I click the button it works the same way. It only gives me the gallery option and not the camera option. When I click the gallery option it closes the app, so this gallery release also did not work.

Maybe it could be the order of the keys, I tried to keep changing their order, but I could not either. The info.plist looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>NSCameraUsageDescription</key>
    <string>Para tirar a foto precisamos de acesso a camera</string>
</dict>
</plist>

I'm using Xcode 9.2 and running the Iphone 8 emulator.

Could anyone help me?

Thankful

    
asked by anonymous 06.03.2018 / 16:49

1 answer

0

You need to add permissions in the Info.plist file.

Camera:

Key       :  Privacy - Camera Usage Description   
Value     :  $(PRODUCT_NAME) camera use

Photo:

Key       :  Privacy - Photo Library Usage Description    
Value     :  $(PRODUCT_NAME) photo use
    
12.03.2018 / 16:30