Reputation: 562
I am getting strange exception when calling the NSDictionary in the following example:
NSInteger userId = 1;
NSDictionary *postData = [NSDictionary dictionaryWithObjectsAndKeys:
@"3", @"a",
@"0", @"b",
userId, @"c",
nil];
Can someone see what's the problem above?
Upvotes: 0
Views: 40
Reputation: 133557
NSDictionary
, as most collections, just accepts real Obj-C objects (id
type), but you are passing a NSInteger
which is a normal C typedef.
Try with NSNumber userId = [NSNumber numberWithInt:1];
Upvotes: 2