iOSで次のクラッシュが発生します。
Unresolved error Error Domain=NSCocoaErrorDomain Code=1550 "The operation couldn’t be completed. (Cocoa error 1550.)" UserInfo=0x74a30d0 {NSValidationErrorObject=<Exercise: 0x9097d50> (entity: Exercise; id: 0x9097970 <x-coredata://AF762754-4CD9-4386-A453-049CC8710DBF/Exercise/p124> ; data: {
groupId = 21;
id = 102;
intensity = "0x906a7a0 <x-coredata://AF762754-4CD9-4386-A453-049CC8710DBF/Intensity/p125>";
lengthMeasurable = 1;
name = Running;
owner = "0x9096540 <x-coredata:///ExerciseEvent/t6817E9A9-9A4C-4044-BF20-FC15380B7C2F4>";
picId = 2719;
}), NSAffectedObjectsErrorKey=(
"<ExerciseEvent: 0x9090910> (entity: ExerciseEvent; id: 0x9096540 <x-coredata:///ExerciseEvent/t6817E9A9-9A4C-4044-BF20-FC15380B7C2F4> ; data: <fault>)"
), Dangling reference to an invalid object.=null, NSValidationErrorKey=owner, NSLocalizedDescription=The operation couldn’t be completed. (Cocoa error 1550.), NSValidationErrorValue=<ExerciseEvent: 0x9090910> (entity: ExerciseEvent; id: 0x9096540 <x-coredata:///ExerciseEvent/t6817E9A9-9A4C-4044-BF20-FC15380B7C2F4> ; data: <fault>)}, {
"Dangling reference to an invalid object." = "<null>";
NSAffectedObjectsErrorKey = (
"<ExerciseEvent: 0x9090910> (entity: ExerciseEvent; id: 0x9096540 <x-coredata:///ExerciseEvent/t6817E9A9-9A4C-4044-BF20-FC15380B7C2F4> ; data: <fault>)"
);
NSLocalizedDescription = "The operation couldn\U2019t be completed. (Cocoa error 1550.)";
NSValidationErrorKey = owner;
NSValidationErrorObject = "<Exercise: 0x9097d50> (entity: Exercise; id: 0x9097970 <x-coredata://AF762754-4CD9-4386-A453-049CC8710DBF/Exercise/p124> ; data: {\n groupId = 21;\n id = 102;\n intensity = \"0x906a7a0 <x-coredata://AF762754-4CD9-4386-A453-049CC8710DBF/Intensity/p125>\";\n lengthMeasurable = 1;\n name = Running;\n owner = \"0x9096540 <x-coredata:///ExerciseEvent/t6817E9A9-9A4C-4044-BF20-FC15380B7C2F4>\";\n picId = 2719;\n})";
NSValidationErrorValue = "<ExerciseEvent: 0x9090910> (entity: ExerciseEvent; id: 0x9096540 <x-coredata:///ExerciseEvent/t6817E9A9-9A4C-4044-BF20-FC15380B7C2F4> ; data: <fault>)";
}
そして、ある時点でこのクラッシュが発生します。そのときに、モデルをに保存ExerciseEvent
しCoreData
ます。だから私は私のビューで次のような新しいエンティティを作成します:
self.ee = [NSEntityDescription insertNewObjectForEntityForName:@"ExerciseEvent" inManagedObjectContext:context]
次に、「保存」と「破棄」の2つのボタンがあります。ExerciseEvent
「破棄」を押すと、エンティティを削除して、コンテキストでnull許容値を取得しないようにする必要があります。ビューで次のように削除します。
[context deleteObject:self.ee];
[context save:nil];
次に、すべてのリストを開くと、ExerciseEvents
上記のように次のクラッシュが発生します。