아래 코드를 참조하면 isKindOfClass
이 클래스를 식별하지 못하는 것으로 나타났습니다.이상한`isKindOfClass` 행동
id parent = [self.tableDataSource objectAtIndex:indexPath.row];
//parent Can be either 'document' or 'folder'
NSLog(@"'%@'='%@' ?",[parent class],[Document class]);
BOOL classCheck = [[parent class] isKindOfClass:[Document class]];
NSLog (@"%@", classCheck? @"Yes!" : @"No!");
콘솔 로그 :
2011-01-20 10 : 44 : 29.746 ApplicationName을 [906 : 307] '문서'= '문서'?
2011-01-20 10 : 44 : 29.756 ApplicationName [906 : 307] 아니요!
이전에이 문제가 발생 했습니까?
문서의 인스턴스가 아닌 경우 로그가 '문서'= '문서'로 표시되는 이유 –
OS와 관련이없는만큼 인기있는 즐겨 찾기 태그이므로 iphone ipad 및 ios를 추가하면 더 많은 조회수가 발생합니다 –
NSLog에서 % @는 객체의 (무엇이든간에)'description' 메소드를 호출하기 때문에,이 경우에는 클래스 이름을 문자열로 반환합니다. 우연의 일치라고 생각하십시오. – Costique