An NSDictionary can only contain Objective-C objects in it (for example, NSString and NSArray ), it cannot contain primitive types such as int , float or char* . Given these limitations, heterogeneous dictionaries are perfectly legal.
If you want to include a number, such as 1 , as a key or value, you must wrap it with NSNumber :
NSDictionary *header=[[NSDictionary alloc] initWithObjectsAndKeys: @"fred", @"title", [NSNumber numberWithInt:1], @"count", nil];
Adam rosenfield
source share