最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

react native - Expo Image Picker launch camera not working in build - Stack Overflow

programmeradmin6浏览0评论

I am using expo-image-picker for taking image, video and selecting photo from gallery. When testing on a device with expo go all these functionalities are working correctly; however test or production builds have the inability to open the camera to take a video nor photo.

I have key/values in my info.list for permissions. I've checked my dependencies and updated to the latest version of expo (52.0.35) and image picker (16.0.5). Any reason there would be an issue with launching camera/video and not with selecting images from the gallery?

    const takePicture = async () => {
        try {
            const options: ImagePicker.ImagePickerOptions = {
                mediaTypes: ['images'],
                allowsEditing: true,
                quality: 1,
            };
            const result = await ImagePicker.launchCameraAsync(options);

            return result;

        } catch (error) {
            console.log('error in take picture', error);
        }
    }

package.json

    "expo": "~52.0.35",
    "expo-asset": "~11.0.3",
    "expo-av": "~15.0.2",
    "expo-camera": "~16.0.14",
    "expo-constants": "~17.0.4",
    "expo-dev-client": "~5.0.11",
    "expo-document-picker": "~13.0.2",
    "expo-font": "~13.0.3",
    "expo-image": "~2.0.4",
    "expo-image-picker": "~16.0.5",

app.json
```[
        "expo-image-picker",
        {
          "photosPermission": "The app accesses your photos and videos to allow visuals to be uploaded.",
          "cameraPermission": "The app accesses your camera to allow visuals to be uploaded.",
          "microphonePermission": "The app accesses your microphone to allow audio to be recorded."
        }
      ],
 
发布评论

评论列表(0)

  1. 暂无评论