I have a dictionary like this
123456
{
"aaa"
"aaav"
}
But when i try to get these values in NSArray using objectForKey, I am getting nil.
The key I am using is a string.
Code :
NSArray *arr = [userdetails objectForKey:str]
Where userdetails is an NSDictionary and str is NSString which contains the key.
NSDictionary cannot contain nil objects. There are two possibilities to get a nil back from objectForKey:
Please make sure that you have created an instance of your NSDictionary or a compatible class (say, NSMutableDictionary) and assign it to the variable prior to querying it for the key. Then make sure the key in question contains an object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With