0
我試圖在CoreData
中保存NSMutableArray
。數組包含對象NSDictionary
歸檔包含字典的NSArray
的NSDictionary有以下結構
valueDict =
{
FloorId = F0001;
endCoordinates = "NSPoint: {541, 413}";
linePath = "<UIBezierPath: 0x1d0903c0>";
pointsOnLine = (
);
startCoordinates = "NSPoint: {418, 504}";
},
要寫入核心數據我用下面的代碼:粒子陣列是輸入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協議。我在這裏做錯了什麼?
FloorId是什麼類型? –
floorId是一個NSString – ila
是「分」NSManagedObject的一個子類嗎? 「parray」是指向NSData的指針嗎? –