React-native-document-picker: getting in "undefined is not an object (evaluating '_reactNativeDocumentPicker.DocumentPicker.show') " in IOS

Created on 24 Apr 2018  ·  7Comments  ·  Source: rnmods/react-native-document-picker

react-native link was not working so I manually linked the module by following steps

  1. Added RNDocumentPicker.xcodeproj to the library
  2. Added libRNDocumentPicker.a to Build Phases -> Link Binary With Libraries

Here is my Code:
import React, { Component } from 'react';
import {AppRegistry,StyleSheet,Button,View} from 'react-native';

import { DocumentPicker, DocumentPickerUtil } from 'react-native-document-picker';

export default class App extends Component {
render() {
return (
onPress={() => this.openDocumentPicker()}
title='Open document picker'
/>

);
}

openDocumentPicker() {
DocumentPicker.show({
filetype: [DocumentPickerUtil.images()],
},(error,res) => {
// Android
console.log(
res.uri,
res.type, // mime type
res.fileName,
res.fileSize
);
});
}

const styles = StyleSheet.create({
container: {
flex: 1,
},
});

AppRegistry.registerComponent('App', () => App);

PS this code is working fine with Android, I tried linking multiple time nothing worked,
Badly stuck need help
document picker
document picker

Most helpful comment

Do anybody fixed this issue? if yes then please provide solution . i am facing same issue. It work good with android but have an issue with ios simulator

All 7 comments

I had issues of the app crashing before, and it was because I did not add iCloud entitlements as described in readme.

Hi, as i'm working on Windows and i am testing on an Android emulator and, with Expo, on an iOS device,
I have the same problem as @kashifaliquazi on my iOS.
I've executed react-native link and I had this message:
image
But i still have the same problem when I run the app.
It doesn't work with my iOS but it works with the emulator Android, perhaps because I've also manually linked natives module on Android Studio.
Despite that I cannot have Xcode, is there any way to make DocumentPicker work on iOS or do I absolutely need to use Xcode ?

Even i am facing the same issue. It was tested and working suddenly its not working now.

Same issue here

Do anybody fixed this issue? if yes then please provide solution . i am facing same issue. It work good with android but have an issue with ios simulator

Delete App from phone and install again using 'react-native run-android'

我用3.2.2也遇到了同样的问题

Was this page helpful?
0 / 5 - 0 ratings