I'm trying to pass a float through a selector using 'withObject:' however, it only accepts objects.
There are solutions that tell me to use [NSNumber numberWithFloat: ] however it's messing with the value of my float. I am doing a before and after testing of the values of the float, and beforehand I get numbers such as 0.0034324, whereas afterwards they are all 0.0000000
[[self gameObjects] makeObjectsPerformSelector:@selector(update:) withObject: <what to put here>]];
Thanks in advance!
EDIT*
here is the context
-(void) tick:(float)dt{
NSLog(@"%f",dt)
[[self gameObjects] makeObjectsPerformSelector:@selector(update:) withObject:[NSNumber numberWithFloat:dt]];
}
The number outputted from above is NOT 0
But from the selector method....
- (void)update:(float)dt{
NSLog(@"%f",dt);
}
The output is 0
floatValueofnilrather than of an actual number. - Tommyupdate:. What is the parameter type? It can't be of typefloatsince you need to pass it anNSNumber. - rmaddy