react-native-keychain: TypeError: Cannot read property 'setGenericPasswordForOptions' of undefined

I use Keychain as basic example:

      Keychain
      .setGenericPassword('myUserName', 'myPassword')
      .then(() => {
        console.log('Credentials saved successfully!');
      });

but this error happens:

screen shot 2017-03-09 at 22 13 24 Do you have any idea why ?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 17
  • Comments: 17 (2 by maintainers)

Most upvoted comments

Had this problem, was solved by running

react-native link
react-native run-ios # or run-android

read more here

this error goes away after a clean rebuild: rm -rf ios/build && react-native run-ios

The only thing that helped me is rebuilding project via Android Studio’s Build -> Rebuild project menu item.