2013-04-26 5 views
0

응용 프로그램이 사진을 서버에 업로드합니다.어설 션 오류 - [UITableView _endCellAnimationsWithContext :] 테이블 뷰를 업데이트하는 중 코어 데이터 가져 오는 중 오류가 발생했습니다.

사용자가 업로드 할 사진을 선택하면 사진의 정보가 핵심 데이터에 저장됩니다. fetchedResultsController을 사용하여 사진 목록을 보여주는 테이블 뷰가 채워집니다.

테이블 뷰에는 진행중인 업로드 섹션, 대기중인 사진 및 완료된 업로드 섹션이 있으며 상태에 따라 업데이트됩니다.

하지만 업로드 할 사진을 추가하려고 할 때 이전 세트가 계속 업로드되는 동안 다시 선택하면 다음과 같은 오류가 발생합니다.

그리고이 후에 테이블 뷰가 비워집니다. 나는 tableview에서 아무것도 볼 수 없습니다.

CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. Invalid update: invalid number of rows in section 1. The number of rows contained in an existing section after the update (96) must be equal to the number of rows contained in that section before the update (62), plus or minus the number of rows inserted or deleted from that section (21 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out). with userInfo (null) 

답변

1

여기서 일어나는 일은 첫 번째 업데이트가 21 개의 셀을 삽입하고 모델에 추가 된 것입니다. 테이블 뷰는 tableView : numberOfRowsInSection :을 호출하여 내부 모델을 업데이트하지만 83 (62 + 21)을 반환하지만 두 번째 업데이트는 모델에 더 많은 항목을 추가하여 실제로는 96을 반환합니다.

메인 스레드 외부에서 UIKit 조작을 호출했기 때문에 (또는 매우 나쁜 경우) 또는 동일한 기능에서 테이블 뷰를 갱신하지 않고 모델을 변경 한 경우.

관련 문제