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?

有帮助吗?

解决方案

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 :)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top