I am currently doing something like this
NSDictionary *imageDataDictionary = nil;
imageDataDictionary = (NSDictionary *)metadataItem.value;
if(imageDataDictionary != nil)
{
if ([imageDataDictionary objectForKey:@"data"] != nil) <---Crashes
{
}
}
The app crashes on
if ([imageDataDictionary objectForKey:@"data"] != nil)
because it has 0 key value pairs. I wanted to know what would the right way be to check if a NSDictionary is valid and if it has any key value pairs
This is the messages
2015-04-19 15:56:37.255 MBlast[61278:2115186] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFData objectForKey:]: unrecognized selector sent to instance 0x7c16a7e0'