DocumentPicker & ImagePicker not working

I’m trying to pic Documents and Images (Gallery & Camera) but somehow it doesn’t work.

For example:

async function handleGalleryUpload(folders) {
  const { api } = this.props;

  const result = await Expo.ImagePicker.launchImageLibraryAsync({});

  console.log(result);
}

This doesn’t log anything.

If I use the DocumentPicker, my App even crashes.

I tried to add permission checks before, but they were okay and it still didn’t do anything.

I’m on Expo 19.

hello!

can you update to sdk22? I didn’t try this on sdk19, but on sdk22 it does work as expected, see: https://snack.expo.io/S1HtdYQ1M

notice that logs appear once you select something

Your example works, but mine doesn’t even after 22 update.

This crashes my app without any notice:

result = await Expo.DocumentPicker.getDocumentAsync({ type: "*/*" });

Is something wrong with my deps?

  "dependencies": {
    "@expo/vector-icons": "^5.0.0",
    "bops": "^1.0.0",
    "buffer": "^5.0.7",
    "expo": "^22.0.0",
    "glamorous-native": "^1.1.1",
    "halfred": "^1.0.0",
    "moment": "^2.19.1",
    "react": "16.0.0-beta.5",
    "react-native": "https://github.com/expo/react-native/archive/sdk-22.0.1.tar.gz",
    "sentry-expo": "^1.6.0"
  }

I’m running iOS 11.1.1

Solved the ImagePicker problem.

I started it from a modal menu. When I moved the call into a setTimeout() of 500ms the gallery UI showed up.

The DocumentPicker still crashes my app, even with timeout.

Tried it with Snack, didn’t work here either.

https://snack.expo.io/S15i1JDJG

tried this on my phone and it worked as expected. where are you picking the document from?

From an iPad pro.

As I said, the Picker UI doesn’t even show up, the whole Expo client simply crashes without any error messages.

Hi, also tried this https://snack.expo.io/ryfSWKRGW (snack for documentpicker & imagepicker) on new ipad 2017 and the same. The expo client close when opening documentpicker, but working for imagepicker. The standalone build just simply doesn’t do anything for the documentpicker.

the snack you linked to uses sdk 19, i switched the version to sdk 25 and saved it here: https://snack.expo.io/HkuSxz6Sf – it should work on this. sdk 19 is an old version.

Hi, oh yes. After I update mine to sdk 25 it also works on the expo client now. I will try to build the standalone now. Thanks @notbrent

The standalone build actually does not show anything when I do DocumentPicker. I already add the usesIcloudStorage in my app json. In my apple developer console I also set the icloud to enabled in my app id. Is there anything more I need to do?

Hi, anyone can tell if there is any progress in documentpicker for ios standalone build or can provide help in how to make it run?

did you add it under the ios key? can you share app.json?

Hi @notbrent, I add it under the ios portion
this is my app.json`

{
    "expo": {
        "name": "Garuda Chat",
        "description": "Garuda Poin Chat",
        "slug": "garuda-chat",
        "privacy": "public",
        "sdkVersion": "25.0.0",
        "version": "1.0.0",
        "orientation": "portrait",
        "primaryColor": "#cccccc",
        "icon": "./assets/icons/Garuda_Chat_Icon.png",
        "loading": {
            "icon": "./assets/icons/Garuda_Chat_Icon_Loading.png",
            "backgroundColor": "#333333",
            "hideExponentText": true
        },
        "packagerOpts": {
            "assetExts": [ "ttf", "mp4" ]
        },
        "ios": {
            "buildNumber": "5",
            "supportsTablet": true,
            "usesIcloudStorage": true,
            "bundleIdentifier": "com.yojimbo.garudapoin.chat"
        },
        "android": {
            "package": "com.yojimbo.garudapoin.chat",
            "versionCode": 1,
            "permissions": [
                "READ_PHONE_STATE",
                "READ_EXTERNAL_STORAGE",
                "READ_INTERNAL_STORAGE",
                "WRITE_EXTERNAL_STORAGE",
                "CAMERA",
                "RECORD_AUDIO",
                "AUDIO_RECORDING",
                "VIBRATE",
                "WAKE_LOCK"
            ]
        },
        "notification": {
            "icon": "./assets/icons/Icon-Garuda-Chat-Notification.png",
            "androidMode": "collapse",
            "androidCollapsedTitle": "#{unread_notifications} new messages"
        }
    }
}

Hello @notbrent do you any more info? Will new EXPO release possibly fix this?

hi there! it looks like there are still some open issues for that, sorry: https://github.com/expo/expo/issues?utf8=✓&q=documentpicker

Ok. thanks for the info.

Are permissions needed for the document picker like they are for the image picker? I was looking at the Expo docs under both document picker and under permissions and neither had anything specific.

https://docs.expo.io/versions/latest/sdk/imagepicker explains that CAMERA_ROLL and depending on usage CAMERA permissions are needed. documentpicker doesn’t require any additional permissions but does need some configuration to work in standalone apps

Hi @notbrent, thanks I already tried to build the standalone apps and the documentpicker shows up now :partying_face:. Just something I realize now is that apple does not allow user to access the device local files :frowning: