react-native-keychain
react-native-keychain copied to clipboard
attempt to insert nil object from objects[3]' was thrown while invoking setGenericPasswordForOptions on target RNKeychainManager with param
Hi,
Can anyone point me in the right direction to resolve this?
iOS 14.4
Exception '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]' was thrown while invoking setGenericPasswordForOptions on target RNKeychainManager with params (
{
authenticationPrompt = {
cancel = Cancel;
title = "Authenticate to retrieve secret";
};
},
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjViNjA1OGY3NiJ9.eyJhdWQiOiJkYzBhZWNmZi0wZjIwLTQxMDItYTY5NS1kYWZlNGJhNTQ0NDgiLCJleHAiOjE2MTY5NjczMTQsImlhdCI6MTYxNjk2MzcxNCwiaXNzIjoiYWNtZS5jb20iLCJzdWIiOiI2YTJjMmI4ZS0zNjMyLTQ2NmYtYjk2NC03ZTA0ZWQ0MmNmNzMiLCJqdGkiOiJjOWE1OGNjNS1mMGQxLTRkOGMtOTY3MS01N2FjYTg1NzdiNTEiLCJhdXRoZW50aWNhdGlvblR5cGUiOiJQQVNTV09SRCIsImVtYWlsIjoiY0BjLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJhcHBsaWNhdGlvbklkIjoiZGMwYWVjZmYtMGYyMC00MTAyLWE2OTUtZGFmZTRiYTU0NDQ4Iiwicm9sZXMiOltdfQ.p_MH0nFstUyfSzst9P8AbaFzzlaMQ84Urh6JZrBwSws",
"
RCTFatal facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&) facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) _dispatch_call_block_and_release _dispatch_client_callout _dispatch_lane_serial_drain _dispatch_lane_invoke _dispatch_workloop_worker_thread _pthread_wqthread start_wqthread
@chrisbarry Any luck solving this?
@bosunolanrewaju No! Still got to try to work out what to do, have inherited an app from someone, this is quite a blocker... maybe have to rip some things out and work back up...
@chrisbarry Looks like I found a fix for our issue.
See this here from https://github.com/oblador/react-native-keychain/blob/master/RNKeychainManager/RNKeychainManager.m#L354-L359:
NSDictionary *attributes = attributes = @{
(__bridge NSString *)kSecClass: (__bridge id)(kSecClassGenericPassword),
(__bridge NSString *)kSecAttrService: service,
(__bridge NSString *)kSecAttrAccount: username,
(__bridge NSString *)kSecValueData: [password dataUsingEncoding:NSUTF8StringEncoding]
};
The error says it is attempting to pass nil at index[3], which means the password
being passed is null. Ensure that the password is not null. In our case, the value was null. Setting it to an empty string fixed it for us.
It is also mentioned in the readme file below the Usage section here that the values are limited to strings only. https://github.com/oblador/react-native-keychain#usage
HTH.
Hi @chrisbarry I have the same problem. v. 7.0.0 very basic setup, iOs, RN 0.64
@chrisbarry for me the problem resolves after adding capabilities in Xcode, see here:
https://github.com/oblador/react-native-keychain#enable-keychain-sharing-entitlement-for-ios-10
In my case the issues was that I was trying to store on object Make sure you only pass strings