0
我正在關注Core Data Utility tutorial,我已經實施了custom managed object class。它建立並運行良好,但價值似乎並不正確。我的CDCLI.cdcli文件充滿了這樣的對象:我應該從Apple的Core Data Utility教程中獲得什麼值?
<object type="RUN" id="z114">
<attribute name="processid" type="int64">1334</attribute>
<attribute name="date" type="date">369155986.60885798931121826172</attribute>
</object>
「date」屬性看起來不像日期。日期和屬性的ProcessID正在設置像這樣:
// Attribute: Date
NSAttributeDescription *dateAttribute = [[NSAttributeDescription alloc] init];
[dateAttribute setName:@"date"];
[dateAttribute setAttributeType:NSDateAttributeType];
[dateAttribute setOptional:NO];
// Attribute: Process ID
NSAttributeDescription *idAttribute = [[NSAttributeDescription alloc] init];
[idAttribute setName:@"processID"];
[idAttribute setAttributeType:NSInteger64AttributeType];
[idAttribute setOptional:NO];
[idAttribute setDefaultValue:[NSNumber numberWithInteger:-1]];
主要基於以下方法,我期待得到「0」作爲的ProcessID屬性值,我不是。
- (void)setNilValueForKey:(NSString *)key {
if ([key isEqualToString:@"processID"]) {
self.processID = 0;
} else {
[super setNilValueForKey:key];
}
}
事實上,添加一些的NSLog聲明,表示方法告訴我,它甚至沒有被調用,這我得弄清楚。
有沒有人知道日期和processID屬性是假設看起來像這樣我可以肯定我得到正確的值?
哇,謝謝你指出。多麼糟糕的錯誤。 – ele