Her*_*ker 2 cocoa objective-c ios
坦率地说,这是一个非常详细的问题.NSMutableDictionary的苹果文档https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/Reference/Reference.html声明:
setObject:forKey:
Adds a given key-value pair to the dictionary.
- (void)setObject:(id)anObject forKey:(id)aKey
Run Code Online (Sandbox Code Playgroud)
根据该参数forKey接受任何对象.但是,当我尝试传递一个NSNumber时,Incompatible pointer types sending 'NSNumber *' to parameter of type 'NSString *'
只有一些NSString被接受为关键.
在我想要的时候,我会将我的号码转换为字符串.最后它只是一把钥匙.但有谁知道谁是对的?文档或编译器?