2012-02-21 57 views
0

OOF核心數據錯誤...這裏有一個問題..上ManagedObjectContext保存

我使用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]; 
} 
} 

我不知道。我敢肯定,我可能還沒有提供足夠的信息來弄清楚這一點。但是,也許如果任何人有什麼我需要包括解決問題的建議?在此先感謝...

+0

顯示此方法的代碼: - [StaffListMasterViewController configureCell:atIndexPath:]。用這些信息更新你的問題,這樣你就可以從文本格式中獲益。 – Jim 2012-02-21 19:46:18

+0

嘿吉姆,就是這樣!我評論說這種方法...甚至不記得爲什麼。非常感謝。你能發表你的評論作爲答案,所以我可以接受它嗎?謝謝 – sayguh 2012-02-21 19:53:08

+0

我連續幾個小時看着這些東西后都會盲目地自己瞎了。祝你好運。 – Jim 2012-02-21 20:05:33

回答

1

顯示此方法的代碼: - [StaffListMasterViewController configureCell:atIndexPath:]。用這些信息更新你的問題,這樣你就可以從文本格式中獲益。

相關問題