Checking for equality in Objective-C
问题 How do i check the key in dictionary is same as the string in method parameter? i.e in below code , dictobj is NSMutableDictionary's object , and for each key in dictobj i need to compare with string. How to achieve this ? Should i typecase key to NSString?? -(void)CheckKeyWithString:(NSString *)string { //foreach key in NSMutableDictionary for(id key in dictobj) { //Check if key is equal to string if(key == string)// this is wrong since key is of type id and string is of NSString,Control