Application creashing in saveAction of Coredata iphone sdk
Posted
by neha
on Stack Overflow
See other posts from Stack Overflow
or by neha
Published on 2010-06-01T07:19:05Z
Indexed on
2010/06/01
7:23 UTC
Read the original article
Hit count: 510
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.
© Stack Overflow or respective owner