次の行でエラーが発生します: if (! [self.event.managedObjectContext save:&error])
。ユーザーが別の数値を textField に入力しなかった場合にのみ発生するため、0
.
- (void)viewWillAppear:(BOOL)animated
{
self.textField.text = 0;
[super viewWillAppear:YES];
}
- (void)addProperty
{
NSDecimalNumber *decimal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%@", self.textField.text]];
event.carPayment = decimal;
NSError *error = nil;
if (! [self.event.managedObjectContext save:&error])
{
// Handle the error.
}
NSLog(@"%@", error);
}
Error: 2011-09-21 20:31:28.101 Calculator[2391:707] Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. NSDecimalNumber overflow exception with userInfo (null)
2011-09-21 20:31:28.144 Calculator[2391:707] *** Terminating app due to uncaught exception 'NSDecimalNumberOverflowException', reason: 'NSDecimalNumber overflow exception'