Unable to use 'class' as a key in NSDictionary with Xcode 4.5

Posted by Vivin Paliath on Stack Overflow See other posts from Stack Overflow or by Vivin Paliath
Published on 2012-09-21T06:29:46Z Indexed on 2012/09/30 9:37 UTC
Read the original article Hit count: 281

Filed under:
|
|

I'm trying to use a class as a key in an NSDictionary. I looked at the answer to this question and what I have is pretty much the same; I'm using setObject: forKey:. However, XCode complains, saying Incompatible pointer types sending 'Class' to parameter of type 'id<NSCopying>'. The call I have is:

[_bugTypeToSerializerDictionary setObject: bugToStringSerializer 
                                forKey: [bugToStringSerializer serializedObjectType]];

bugToStringSerializer is an instance of BugToStringSerializer whose concrete implementations implement serializedObjectType. An example of a concrete implementation looks like this:

- (Class) serializedObjectType {
    return [InfectableBug class];
}

What am I doing wrong here?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about class