ios - Incompatible pointer types sending 'int' to parameter of type 'va_list' (aka 'char') -


i have simple yet frustrating problem.

i have line in app:

[super settext:[[[nsstring alloc] initwithformat:@"%i" arguments:arg] autorelease]]; 

that line 3rd party library trying rid of warning , make work properly. anyway how fix warning?

thanks!

full method:

- (void)timerloop:(nstimer *)atimer {     //update current value     currenttextnumber += currentstep;      //check if timer needs disabled     if ( (currentstep >= 0 && currenttextnumber >= textnumber) || (currentstep < 0 && currenttextnumber <= textnumber) ) {         currenttextnumber = textnumber;         [self.timer invalidate];     }      //update label using specified format     int value = (int)currenttextnumber;     int *arg = (int *)malloc(sizeof(int));     memcpy(arg, &value, sizeof(int));     //call superclass show appropriate text     [super settext:[[[nsstring alloc] initwithformat:@"%i" arguments:arg] autorelease]];     free(arg); } 

why not change to:

nsstring *text = [nsstring stringwithformat:@"%i", arg]; [super settext:text]; 

this assumes arg has type of int.

you use initwithformat:arguments: if arg va_list variable argument list.

update: based on updated code posted can do:

- (void)timerloop:(nstimer *)atimer {     //update current value     currenttextnumber += currentstep;      //check if timer needs disabled     if ( (currentstep >= 0 && currenttextnumber >= textnumber) || (currentstep < 0 && currenttextnumber <= textnumber) ) {         currenttextnumber = textnumber;         [self.timer invalidate];     }      //update label using specified format     int value = (int)currenttextnumber;     [super settext:[nsstring stringwithformat:@"%i", value]]; } 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -