iPhone Check Empty dictionary

dictionary, ios, iphone

Solution

Use `count`.

For example:

if ([dict count] == 0) {
     NSLog("empty");
}

If you want to check for a key then:

if([dict objectForKey:@"photo"]) {
    NSLog(@"There's an object in photo");
}

Problem

``` if ([dict objectForKey:@"photo"] !=(id)[NSNull null]) {NSLOG(@"dictinary is not empty")} ``` This is not working for me. to check empty tag

Original source