teepusink
teepusink

Reputation: 28922

NSDictionary objectForKey not working

I have an NSDictionary that when I NSLog prints this out

{
    206510 = 1;
    622845 = 1;
    926131 = "";
    100000977163362 = "";
}

Why does

[dict objectForKey:@"206510"]

gives null?

This is how I setup the dictionary in the first place.

[dict setObject:[status objectForKey:@"game_status"] forKey:(NSString*) [status objectForKey:@"id"]];

Thanks,
Tee

Upvotes: 1

Views: 1471

Answers (1)

olliej
olliej

Reputation: 36793

Are your keys strings or numbers? NSDictionary keys off an id (your cast to NSString is unnecessary, and possibly wrong), eg. any objective-c object, you may want (entirely guesswork here):

[NSNumber numberWithDouble: 206510.0]

Upvotes: 1

Related Questions