【问题标题】:Core Data error on ManagedObjectContext SaveManagedObjectContext Save 上的核心数据错误
【发布时间】:2012-02-21 19:38:57
【问题描述】:

哎呀...这里有问题..

我正在使用 CoreData,我的导航控制器的根视图提供了一个人员列表。

如果我点击一个员工,我会推送该员工的详细视图。

如果我单击其中一个详细信息字段(即“名称”或“位置”),我会推送一个编辑视图控制器,我可以在其中更改数据然后保存。

我有两个不同的编辑控制器...一个用于简单文本编辑(“EditTextController”),一个用于位置(“EditLocationController”),这是一个关系字段,您可以从列表中选择位置。

如果我创建一个新员工,一切都会完美运行。我什至可以毫无错误地更新任何文本字段或位置字段。

当我尝试更新现有员工时,问题就出现了。我可以更改他们的位置没问题......没有错误。但是,如果我尝试更新现有员工的文本字段,则会出现严重错误。

-[StaffListMasterViewController configureCell:atIndexPath:]: unrecognized selector sent to     instance 0x6d7e650
2012-02-21 14:32:14.663 FanOut[2664:fb03] CoreData: error: Serious application error.      
Exception was caught during Core Data change processing.  This is usually a bug within an 
observer of NSManagedObjectContextObjectsDidChangeNotification.  -    
[StaffListMasterViewController configureCell:atIndexPath:]: unrecognized selector sent to  
instance 0x6d7e650 with userInfo (null)
2012-02-21 14:32:14.665 FanOut[2664:fb03] *** Terminating app due to uncaught exception  
'NSInvalidArgumentException', reason: '-[StaffListMasterViewController configureCell:atIndexPath:]: unrecognized selector sent to instance 0x6d7e650'

这很令人困惑,因为两个控制器中的代码似乎相同

- (void) saveButtonPressed:(id) sender {

[managedObject setValue:textField.text forKey:keyString];

//Save the context
NSError *error = nil;
if (![self.managedObjectContext save:&error]) {
    NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
    abort();
} else {
     [self.navigationController popViewControllerAnimated:YES];
}
}

我不知道.. 我确定我可能没有提供足够的信息来解决这个问题。但也许如果有人对我还需要包括哪些内容进行故障排除有任何建议?在此先感谢...

【问题讨论】:

  • 显示此方法的代码:-[StaffListMasterViewController configureCell:atIndexPath:]。使用此信息更新您的问题,以便您可以从文本格式中受益。
  • 嘿吉姆,就是这样!我注释掉了那个方法......甚至不记得为什么。非常感谢。您可以发表您的评论作为答案,以便我接受吗?谢谢
  • 连续几个小时看着这些东西,我自己都瞎了。祝你好运。

标签: objective-c core-data ios5


【解决方案1】:

显示此方法的代码:-[StaffListMasterViewController configureCell:atIndexPath:]。使用此信息更新您的问题,以便您获得文本格式的好处。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-18
    • 2018-01-25
    • 1970-01-01
    • 2016-11-29
    • 1970-01-01
    • 1970-01-01
    • 2011-12-29
    • 2012-01-20
    相关资源
    最近更新 更多