Why 'initWithObjectsAndKeys:' doesn't throw a casting warning? (NSDictionary)
- by rubdottocom
Sorry if the question isn't correct, I'm very new in Objective-C.
I understand why this code throw the Warning: "warning: passing argument 1 of 'initWithObjectsAndKeys:' makes pointer from integer without"
NSDictionary *dictNames =
[[NSDictionary alloc] initWithObjectsAndKeys:
3, @"",
4, @"",
5, @"",nil];
Keys and Values of a NSDictionary must be NSObject and not fundamental types, like the integers 3, 4 and 5. (Correct me if necessary).
But I don't understand why this warning dissapears with the only "correct typing" of the first Key.
NSDictionary *dictNames =
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInteger:3], @"",
4, @"",
5, @"",nil];
It's because NSDictionary assumes the type of the other Keys? Is correct this manner of initialization?