在NSLog中,方法返回一个颠倒的问号

时间:2013-05-04 18:16:14

标签: ios objective-c boolean string-formatting nslog

我可以访问声明如下的属性:

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

- (BOOL)isPrivateShortDay;

使用以下内容:

int sick = aModel.privateSickDay;


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

但是,当我尝试使用该方法时,我的NSLog中出现了一个颠倒的问号:

BOOL shortness = [aModel isPrivateShortDay];

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

所以,我把一些NSLog放入方法本身......

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

_shortnessStatus:也会返回一个倒置的问号。这是什么意思,我该如何解决?

1 个答案:

答案 0 :(得分:9)

只需在NSLog语句中将%c更改为%i