I want to check if an NSDictionary
is empty. I am doing it like this.
mutDictValues = [[[NSUserDefaults standardUserDefaults] objectForKey:@\"dicV
I had a bit different issue but it is related so i would like to share it here.
I was fetching the webservices & storing data in NSDictionary & again Fetching objectForKey which was Null. So the solution i found is as under
NSMutableDictionary *result = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil];
// NSLog(@"%@" , result);
NSMutableDictionary *sup = [result objectForKey:@"keysupplied"];
NSNull *n=[NSNull null];
if ( sup ! = n ){
//Your code if its not null
}
The reason behind using NSNull was it was returning (NSNull *) when i debugged the application So i finally figured out this way.