Question

I have a method that receives an nsinteger, then I need to convert it to a nsnumber, but I get a really strange number, my code is:

+(TarefaMR *)GetTask:(NSInteger *)idTask {   
    NSLog(@"idTask %@",[NSNumber numberWithInteger:idTask]);
    NSInteger *tt=111;    
    NSLog(@"tt %@",[NSNumber numberWithInteger:tt]); 
}

my idtask is 888 and I get a 203513664 while the tt variable is working , I get the 111, what can be the problem?

Was it helpful?

Solution

You shouldn't use NSInteger as a reference. Try removing the * from behind every mention to NSInteger you do. Remember, NSInteger are not objects, they're just a cool way to name "int"s :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top