Search code examples
iosobjective-cbooleanstring-formattingnslog

In NSLog, methods return an upsidedown question mark


I can access a property declared like so:

@property (nonatomic, assign, getter = isPrivateSickDay) BOOL   privateSickDay; 

- (BOOL)isPrivateShortDay;

Using the following:

int sick = aModel.privateSickDay;


NSLog(@"zero for not sick, one for sick %d", sick);

However, when I try to use the method, I get an upside down question mark in my NSLog:

BOOL shortness = [aModel isPrivateShortDay];

NSLog(@"shortness: %c", shortness);

So, I put some NSLogs into the method itself...

- (BOOL)isPrivateShortDay {
NSLog(@"Shortness called");
NSLog(@"FfDateStatus_ShortWorkingDay_Private: %d",FfDateStatus_ShortWorkingDay_Private);
NSLog(@"_shortnessStatus: %c",self->_shortnessStatus);
return (FfDateStatus_ShortWorkingDay_Private == self->_shortnessStatus);
 }

And _shortnessStatus: also returns an upsidedown question mark. What does this mean and how can I fix it?


Solution

  • Just change %c to %i in the NSLog statement.