我正在使用以下代码转换NSArray
EKEvent
为,NSData
转换NSData
为. 转换时,对象被更改并保存该值。unarchiveObjectWithData
NSArray
null
为什么会显示 NULL
。(请参阅输出)。任何知道解决方案的人告诉我。提前致谢。
我写的代码,
NSArray *events = [[self.eventStore eventsMatchingPredicate:predicate]retain];
NSData *arrayData = [NSKeyedArchiver archivedDataWithRootObject:events];
NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:arrayData];
输出是
事件:(“EKEvent <0x4ad840> {EKEvent <0x4ad840> {title =检查日历;日历 = EKCalendar <0x4bf2f0> {title = 日历;类型 = 本地;帐户 =(空);allowsModify = YES;颜色 = 0.443137 0.101961 0.462745 1.000000}; 警报 = (\n \"EKAlarm <0x4be630> {triggerInterval = -300.000000}\"\n); URL = (null); lastModified = 2012-05-14 12:15:32 +0000}; 位置 = (null); startDate = 2012-05-11 01:30:00 +0000; endDate = 2012-05-19 17:30:00 +0000; allDay = 0; float = 0; 重复 = (null); 参加者 = (null)}" )
数组: ( "EKEvent <0x4c1e60> {EKEvent <0x4c1e60> {title = ( null); 日历 = (null); 警报 = (null); URL = (null); lastModified = (null)}; 位置=(空);开始日期 = (null); endDate = (null); allDay = 0; 浮动 = 1; 复发=(空);参加者 = (null)}" )