天天看點

如何判斷NSMutableDictionary是否有某個key

if ([[dict allKeys] containsObject:key) {
    // contains key
}

      

 // contains key

}

if ([dict objectForKey:key]) {  //objectForKey will return nil if a key doesn't exists.
 
// contains key
}      

// contains key

繼續閱讀