Reputation: 10969
How can I tell if an NSMutableDictionary
is empty in Objective-C?
Upvotes: 29
Views: 21541
Reputation: 3523
I have also faced this problem. Below code is working for me on iOS 7.0.
[dict isKindOfClass:[NSNull class]];
Upvotes: 2
Reputation: 163258
Very simple, use the -count
method inherited from NSDictionary
:
NSMutableDictionary *dict = ...
BOOL isEmpty = ([dict count] == 0);
Upvotes: 74