Application creashing in saveAction of Coredata iphone sdk
- by neha
Hi all,
In my application I'm inserting data using Coredata like this:
GoodWork * newGoodwork = (GoodWork *)[NSEntityDescription
insertNewObjectForEntityForName:@"GoodWork"
inManagedObjectContext:self.managedObjectContext];
// Step 2: Set Properties
[newGoodwork setEletitle:[NSString stringWithFormat:@"%@", aGoodwork.eletitle]];
[newGoodwork setEletxt:[NSString stringWithFormat:@"%@", aGoodwork.eletxt]];
[newGoodwork setSortId:[NSNumber numberWithInt:sortId]];
// Step 3: Save Object
[self saveAction];
Everythinng is working fine but in saveAction which is:
- (void)saveAction {
NSError *error;
if (![self.managedObjectContext save:&error]) {
NSLog(@"Unresolved Core Data Save error %@, %@", error, [error userInfo]);
exit(-1);
}
}
My application is crashing after processing if condition.
I'm not inserting all the fields in the entity "Goodwork". Can that be the reason?
Thanx in advance.