objective c - NSNumber returning different value than the original int -


i quite new objective-c , trying convert int nsnumber can save core-data.

i've following piece of code (index nsinteger)

- (void) associateornottoaroutine:(nsstring*)exercisename associate:(bool)associate index:(nsinteger)index  nslog(@"number w index %d, %d",[nsnumber numberwithinteger:index],index); 

and returns

number w index 170413600, 2 

i need int of 2 translated number 2 along other numbers translated correct number... tell me why getting convertion? tried reading on nsnumber manual found nothing

try:

nslog(@"number w index %@, %d",[nsnumber numberwithinteger:index],index);                        ^^ 

the %@ format specifier call [nsnumber description] method, should return value after. original code return address of nsnumber object, not content.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -