Objective-C Language Vérifiez si NSDictionary a déjà une clé ou non


Objectif c:

   //this is the dictionary you start with. 
 NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"name1", @"Sam",@"name2", @"Sanju",nil];

//check if the dictionary contains the key you are going to modify.  In this example, @"Sam"
if (dict[@"name1"] != nil) {
    //there is an entry for Key name1       
else {
    //There is no entry for name1