ahoura ahoura - 5 months ago 48
Objective-C Question

NSLog doesnt work with float?

I am trying to do nslog on a float value using :

NSLog(@"THE LOG SCORE : %@", x);

and I have also tried :

NSLog(@"THE LOG SCORE : %@", [NSString stringWithFormat:@"%@", x]);

but it doesnt work! any thoughts why it wouldnt work? the error I get is



The %@ is intended to work on an object, a float is not an object. To do a float try:

NSLog(@"THE LOG SCORE : %f", x);

Here's a helpful article