当我尝试打印时,我有自定义类型对象的数组' s显示我像数组:
(
"",
"",
)
如果我正在访问单个元素,即使正确打印元素打印属性,它也会显示空白。为什么?
更新:
NSLog(@"%@",[[EventStore sharedEventStore] calendars]);
result - 2016-10-14 16:10:15.090 Sample[46141:431203] (
"",
""
)
当我迭代它时:
for (Calendar *c in [[EventStore sharedEventStore] calendars]) {
NSLog(@"Calendar - %@",c);
NSLog(@"Calendar tille - %@",c.title);
NSLog(@"Calendar color - %@",c.color);
}
2016-10-14 16:04:48.879样本[52679:1434653]日历 -
2016-10-14 16:04:56.221 Sample [52679:1434653] Calendar tille - amanda@dev.com
2016-10-14 16:04:58.029 Sample [52679:1434653] Calendar color - (null)
2016-10-14 16:05:01.683 Sample [52679:1434653] Calendar -
2016-10-14 16:08:29.103 Sample [52679:1434653] Calendar tille - 手球练习
2016-10-14 16:08:29.637 Sample [52679:1434653] Calendar color - (null)
答案 0 :(得分:2)
您班级的NSLog显示取决于您班级description
的实施情况。您的Calendar类具有description
属性,其值为空字符串。