Data argument not used by format string
Following videos on lynda c facility I ran a little problem,
#import <Foundation/Foundation.h>
#import "Player.h"
int main(int argc, const char * argv[])
{
@autoreleasepool {
Player *p = [[Player alloc] init];
NSLog(@"The score is @i", [p score]); <-- Data argument not used by format string
}
return 0;
}
You don't have a valid format string. You want %i
, not @i
.
Use NSLog(@"The score is %i", [p score]);
score
returns an integer so %i
or %d
should not be used@i
If the value returned by [p score] is an integer, it must be NSLog (@ "Score % i ", [p score]); // Always use '%' as a format specifier, not '@'
The format string should be used %i
instead of @i
:
NSLog(@"The score is %i", [p score]);