Jeremy Wagner
Jeremy Wagner

Reputation: 143

Cannot read property getPermissionStatus of undefined | react-native-permissions

I'm getting this error when calling Permissions.check() using the react-native-permissions library

getPermissionStatus error

I'm using the code straight from the react-native-permissions README

  componentWillMount() {
    Permissions.check('photo').then(response => {
        console.log(response);
    });
}

I used react-native link to link it.

react-native link react-native-permissions

I'm pretty sure it's linked correctly because when I call Permissions.getTypes()

componentWillMount() {
    console.log(Permissions.getTypes());
}

I get the following response:

getTypes response

React Native Version: 0.53.0

React Native Permissions Version: 1.1.1

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'

target 'myApp' do
  pod 'Stripe', '~> 11.2.0'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

  pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'

end

Edits

Upvotes: 1

Views: 2599

Answers (1)

Jeremy Wagner
Jeremy Wagner

Reputation: 143

It turns out,

Permissions.getTypes()

works without linking.

I ended up having to follow the manual linking instructions here: using manual linking

Using manual linking

In the XCode's "Project navigator", right click on your project's Libraries folder ➜ Add Files to <...>

Go to node_modules ➜ react-native-permissions ➜ select ReactNativePermissions.xcodeproj

Add libReactNativePermissions.a to Build Phases -> Link Binary With Libraries

Upvotes: 2

Related Questions