我正在尝试保存一个NSMutableArray
in CoreData
。数组包含对象NSDictionary
NSDictionary 具有以下结构
valueDict =
{
FloorId = F0001;
endCoordinates = "NSPoint: {541, 413}";
linePath = "<UIBezierPath: 0x1d0903c0>";
pointsOnLine = (
);
startCoordinates = "NSPoint: {418, 504}";
},
要写入核心数据,我使用以下代码: parray is type BinaryData
points.parray = [NSKeyedArchiver archivedDataWithRootObject:self.locationsArray];
并检索我使用的价值
locationsArray = [NSKeyedUnarchiver unarchiveObjectWithData:points.parray];
当我尝试检索它时,出现以下错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSDictionary initWithObjects:forKeys:]: count of objects (0) differs from count of keys (5)'
我检查了 NSArray 和 NSDictionary 采用 NSCoding 协议。我在这里做错了什么?