判断一个字典中是否存在某个key,有两种方法:
方法一:
if ([dictionary allKeys] containsObject: key]){
// cotains key
operation;
}
方法二:
if ([dictionary objectForKey: key]){ // objectForKey will return nil if a key doesn't exists.
// cotains key
operation;
}