사전의 키를 확인하는 방법은 메서드 매개 변수의 문자열과 동일합니까? 즉, 아래의 코드에서 dictobj는 NSMutableDictionary의 객체이고 dictobj의 각 키에 대해 문자열과 비교해야합니다. 이것을 달성하는 방법? NSString에 키를 typecase해야합니까 ??Objective-C에서 동등성 검사
-(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 doesn't come into this line
{
//do some operation
}
}
}
우수한 ... 고맙다 롭. – suse