我得到了一些我无法得到的奇怪东西。我正在使用第三方控件(https://github.com/brunow/TableKit.m),它可以:
+ (NSSet *)cellMappingsForObject:(id)object mappings:(NSDictionary *)mappings {
NSString *objectStringName = NSStringFromClass([object class]);
return [mappings objectForKey:objectStringName];
}
它根据类的名称创建一个映射:
[TKCellMapping mappingForObjectClass:[NSMutableDictionary class] block:^(TKCellMapping *cellMapping) {
//CODE
}];
它会根据它的映射检查数据源对象。这些对象是为我构建的:
while ([rs next]) {
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
for (NSString *fieldName in [props allKeys]) {
//CODE
[dict setValue:fieldValue forKey:fieldName];
}
[list addObject :dict]; //<--This is the datasource. The map is against each dict
}
所以,我所说的到处都是NSMutableDictionary
. 但是后来发生了这件奇怪的事情。
当它调用NSStringFromClass([NSMutableDictionary class])
它时说NSMutableDictionary
,但当它调用NSStringFromClass([rowDict class])
它时说__NSDictionaryM
!
为什么会这样?我检查的标题__NSDictionaryM
和 Xcode 导航到NSMutableDictionary
(?)。我无法从__NSDictionaryM
.
顺便说一句,我需要做什么NSStringFromClass
才能完全替换NSMutableDictionary
?