1
好的,所以我的问题很简单。我需要我的一个属性是可选的。 10.7以下& 10.8很好,但在Snow Leopard下它崩溃了。当我取消选中“可选”时,它不会再崩溃,但现在保存会导致错误,并且不会发生。Snow Leopard中可选属性崩溃的实体
这是我如何设置管理对象上下文:
self.notesPersistentStore = [self.notesStoreCoordinator
addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil
URL:self.notesStoreUrl
options:nil
error:nil];
_notesContext = [[NSManagedObjectContext alloc] init];
_notesContext.mergePolicy = NSMergeByPropertyStoreTrumpMergePolicy;
[_notesContext setPersistentStoreCoordinator:self.notesStoreCoordinator];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(notesContextChanged:)
name:NSManagedObjectContextObjectsDidChangeNotification
object:self.notesContext];
而这正是它崩溃的部分:
- (void)notesContextChanged:(NSNotification *)notification_
{
[self.notesContext save:nil];
}