Initialization makes integer without a cast
I get this warning and I am not sure how to fix it. The line where I get the warning is
NSInteger thescore = [[myDictionary objectForKey:@"Score"] objectAtIndex:0];
If it makes a difference, myDictionary is a NSDictionary
Edit: How is this? Btw my array is a NSMutableArray and not a NSArray
NSInteger thescore = [[myDictionary valueForKey:@"Score"] integerValue];
Edit 2: @Bavarious mentioned that I should do the following:
int thescore = [[myDictionary objectForKey:@"Scor开发者_运维知识库e"] integerValue];
The result of call [someArray objectAtIndex:0]
is an object. And NSInteger
is a primitive type:
typedef long NSInteger;
(cmd + double-click on NSInteger
in xcode to see the definition)
I guess you might actually be storing NSNumber
objects in your array. In this case, you could do
NSNumber *thescore = [someArray objectAtIndex:0];
精彩评论