문제

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