分类category

.h

#import <Foundation/Foundation.h>

@interface NSDictionary (BMDicCategory)

- (BOOL)isHaveKey:(NSString*)key;

@end

.m

#import "NSDictionary+BMDicCategory.h"

@implementation NSDictionary (BMDicCategory)

- (BOOL)isHaveKey:(NSString *)key{
    
    NSDictionary *dict = [self copy];
    
    if (key.isBlankString) {
        return NO;
    }
    
    if([[dict allKeys] containsObject:key])
    {
        return YES;
        
    }else{
    
        return NO;
    }
    
}

@end