Xcode 7.3: 为什么NSArray打印自定义对象为“”?

Xcode 7.3: NSArray print custom objects as "" why?

当我尝试打印时,我有一个带有自定义类型对象的数组,它显示为数组:

 (
    "",

    "",
 )

如果我正在访问单个元素,它会显示空白 space 即使打印 属性 元素打印 correctly.why?

更新:

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 Sample[52679:1434653] Calendar -

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 - Handball practice

2016-10-14 16:08:29.637 Sample[52679:1434653] Calendar color - (null)

您的 class 的 NSLog 显示取决于您的 class 对 description 的实施。您的日历 class 有一个 description 属性,其值为空字符串。