Q:

How to get integer from CCArray - cocos2d

i have a CCArray   
    CCArray *indexs;

then i add a integer into it  
    int x = 0;
    [indexs addObject:[NSNumber numberWithInteger:x]];

then i want to get this integer from this CCArray  
    id temp1 = [indexs objectAtIndex:0];
    int firstOne = (int) temp1;

then i try using CCLOG  
    CCLOG(@"%d", firstOne);

it shows a random number in the terminal, then i try  
    CCLOG(@"%@", firstOne);

it shows 0 in the terminal, and i tried to pass firstOne into a function, firstOne's value is not 0, then how can i get a integer value from my CCArray? thank you

A:

Code as, 
int firstOne = [temp1 intValue];

