I'm writing an app that communicate with a server. The server uses json, so I take this json in my app and I serialize the result into a NSMutableDictionary
that then is used to create a new entity.
This is the code :
if (context == nil) {
context = [(AppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
}
UserTable *ut = [NSEntityDescription insertNewObjectForEntityForName:@"UserTable" inManagedObjectContext:context];
ut.user = [Diz objectForKey:@"user"];
ut.email = [Diz objectForKey:@"email"];
ut.phone = [Diz objectForKey:@"phone"];
NSError *error = nil;
if (![context save:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
}
All works perfectly in iOS 4.3, iOS 6.0 and 6.1. In iOS 5.0.1 this code causse an exc_bad_Address localized in [context save:&error]
or localized sometimes in ut.phone=[Diz objectForKey:@"phone"]
.
I'm using only one context (I have test threading composition with "isMainThread" function), What I can do? My error log is empty,the app simply does a crash.
EDIT
Thanks for the suggestions. I'm already removing my app from the device, but i'll try to do a migration. I have enabled exception breakpoint, but it's the same... The app crash without log any error (i have also NsZombie enabled). During the crash the green breakpoint is setted on an attribute of the Entity "UserTable" ,if i remove this attribute from saving the breakpoint is setted in the save function.
EDIT
After many tests i have detect a standard behavior for this crash. My Entity UserTable has 31 attributes, if i delete one attribute all works correctly... i have already tried to recreate the entity with another name and with others attribute's name but the behavior is the same... What does it means? There's a limit for entity's attributes number? Any other suggestions?