valueForKey只返回内存地址而不是实际值

Jas*_*son 3 iphone objective-c nsdictionary memory-address nsinteger

    NSDictionary *topic = [spaces objectAtIndex:i];
    NSInteger topicid = [topic valueForKey:@"TOPICID"];
Run Code Online (Sandbox Code Playgroud)

当我运行这个并打印出主题时,我得到以下内容:

Printing description of topic:
<CFDictionary 0xdb2a70 [0x30307a00]>{type = mutable, count = 2, capacity = 12, pairs = (
    10 : <CFString 0xdb5300 [0x30307a00]>{contents = "TOPICID"} = 29
    12 : <CFString 0xdb53a0 [0x30307a00]>{contents = "TOPICNAME"} = <CFString 0xdb5360 [0x30307a00]>{contents = "zzzzzzzz"}
)}
Run Code Online (Sandbox Code Playgroud)

但是,当我查看topicid时,值始终是内存地址.我究竟做错了什么?

Xet*_*ius 7

也许这个值实际上是一个NSNumber.你会得到这个:

NSInteger topicid = [[topic objectForKey:@"TOPICID"] intValue];
Run Code Online (Sandbox Code Playgroud)