알아낼 수없는 이상한 문제가 있습니다. 꽤 UIViewController
은 UITableView
이고 NSFetchedResultsController
은 SQLite 저장소에서 가져 오는 개체입니다. 페치 잘 작동 테이블은 전형적인 NSFetchedResultsController
보일러와 함께 잘 작동 : 나는 데 문제가이유없이 가져온 결과에서 관리 객체가 제거되었습니다.
-(void)controllerWillChangeContent:(NSFetchedResultsController *)controller{
[self.tableView beginUpdates];
}
-(void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type{
if(type==NSFetchedResultsChangeInsert){
[self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
} else if(type==NSFetchedResultsChangeDelete){
[self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
}
}
-(void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath{
UITableView *tV = self.tableView;
if(type==NSFetchedResultsChangeInsert){
[tV insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if(type==NSFetchedResultsChangeDelete){
[tV deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if(type==NSFetchedResultsChangeUpdate){
[self configureCell:[tV cellForRowAtIndexPath:indexPath] atIndexPath:indexPath];
} else if(type==NSFetchedResultsChangeMove){
[tV deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tV insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
-(void)controllerDidChangeContent:(NSFetchedResultsController *)controller{
[self.tableView endUpdates];
}
그 관계 속성이 인출 요청에 포함되지 않은 경우에도 (전무 어떤 관계 객체 술어 또는 정렬 설명자에서) 어떤 식 으로든 업데이트 될 때마다 (예 : 관련없는 속성 변경) 가져온 결과 (이 NSFetchedResultsChangeDelete
과 함께 호출 됨)에서 사라집니다. 가져 오기를 다시 수행하면 개체가 다시 나타납니다.
이렇게하면 가져 오기 요청에 조건자를 사용하지 않아도 발생합니다.
아무도 여기에서 무슨 일이 벌어지고 있는지 알 수 있습니까?
항상 이유가 있습니다. 반역죄와 같은 것이 없습니다. D – tGilani
운율에 감사드립니다. –
엔티티/속성/관계에 대한 설명을 추가하고 가져온 결과 컨트롤러를 만드는 방법에 대한 코드도 표시해야합니다. –