在Objective-C(OS X 10.9)中,我编写了一个NSDictionary以便与[MyDict writeToFile:SavePath atomically:YES];
一起存档。我恢复字典与MyDict = [NSDictionary dictionaryWithContentsOfFile:filePath];
将NSCalendarDate转换为xml文件并返回__NSTaggedDate
但是,然后我遇到一个包含NSCalendarDate对象的键不再是NSCalendarDate,而是__NSTaggedDate。这使我有以下错误:
2016-09-06 09:19:39.957 MyProject[720:303] -[__NSTaggedDate yearOfCommonEra]: unrecognized selector sent to instance 0x41bd7801f000000d
上的代码行:
if([AtTansaction.TransactionDate yearOfCommonEra] == DataArray[cnt].year)
因此,如何重建一个NSCalendarDate?什么是NSTaggedDate?
您究竟在哪里找到名为NSCalendarDate的类?它在iOS API吗?可能你试图提到NSDate。你真的不需要关心NSTaggedDate是什么。这可能是该班级的一些内部表现。 – Sandeep
@Sandeep它被标记为OS X,'NSCalendarDate'继承自'NSDate'。 – Larme
'NSCalendarDate'已弃用。 *强烈推荐使用NSCalendarDate 。对于日历计算,您应该使用适合的NSCalendar,NSDate和NSDateComponents组合,如日历和时间日历和时间编程主题中为Cocoa * – vadian