react-native-userdefaults-ios icon indicating copy to clipboard operation
react-native-userdefaults-ios copied to clipboard

undefined is not an object (evaluating 'UserDefaults.setObjectForKey')

Open kenjim83 opened this issue 9 years ago • 5 comments

On line 7 of RNUserDefaultsIOS.js, var _setObjectForKey = Promise.promisify(UserDefaults.setObjectForKey);

it seems UserDefaults was not set because there is no RNUserDefaultsIOS inside NativeModules. (line 5).

I followed the installation README very closely I don't think it did anything wrong. Any ideas? Thanks!

kenjim83 avatar Apr 20 '16 21:04 kenjim83

Thanks for reporting this. What version of RN are you using?

dsibiski avatar Apr 21 '16 21:04 dsibiski

Hi Dave,

I'm using react-native 0.23.1. Thanks!

-Kenji On Apr 21, 2016 2:36 PM, "Dave Sibiski" [email protected] wrote:

Thanks for reporting this. What version of RN are you using?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/dsibiski/react-native-userdefaults-ios/issues/10#issuecomment-213122697

kenjim83 avatar Apr 22 '16 07:04 kenjim83

I'm getting the same issue using RN 0.41.1 and the latest version of react-native-userdefaults-ios. Seems to have issues linking correctly. I am using CocoaPods and an .xcworkspace if that makes any difference in how it links.

Thanks in advance for any help.

SteffeyDev avatar Feb 04 '17 16:02 SteffeyDev

same issue in RN 0.43

Winston-liu-ray avatar Sep 05 '17 02:09 Winston-liu-ray

In case anyone is still getting this issue, it looks like a typo in the README. In step 4, add Products/libRNUserDefaultsIOS.a to the libraries of your project, not RNUserDefaults.xcodproj.

LK avatar Jul 12 '18 16:07 LK