views:

135

answers:

3

Hello everyone, I'm using the NSFetchedResultsControllerDelegate to update my tableview. For example,

//Now tableview doesn't have any record.

2009-11-15 12:25:48.328 XXX[36890:207] 0 //num sections before update //call tableview begin update

2009-11-15 12:25:54.277 XXX[36890:207] insert 0 //insert new section //begin to insert data

2009-11-15 12:25:54.278 XXX[36890:207] NSFetchedResultsChangeInsert: row:31 section:0 2009-11-15 12:25:54.278 XXX[36890:207] NSFetchedResultsChangeInsert: row:30 section:0 2009-11-15 12:25:54.278 XXX[36890:207] NSFetchedResultsChangeInsert: row:45 section:0 2009-11-15 12:25:54.279 XXX[36890:207] NSFetchedResultsChangeInsert: row:62 section:0 2009-11-15 12:25:54.279 XXX[36890:207] NSFetchedResultsChangeInsert: row:12 section:0 2009-11-15 12:25:54.280 XXX[36890:207] NSFetchedResultsChangeInsert: row:54 section:0 2009-11-15 12:25:54.280 XXX[36890:207] NSFetchedResultsChangeInsert: row:2 section:0 2009-11-15 12:25:54.280 XXX[36890:207] NSFetchedResultsChangeInsert: row:14 section:0 2009-11-15 12:25:54.281 XXX[36890:207] NSFetchedResultsChangeInsert: row:63 section:0 2009-11-15 12:25:54.281 XXX[36890:207] NSFetchedResultsChangeInsert: row:27 section:0 2009-11-15 12:25:54.281 XXX[36890:207] NSFetchedResultsChangeInsert: row:5 section:0 2009-11-15 12:25:54.282 XXX[36890:207] NSFetchedResultsChangeInsert: row:7 section:0 2009-11-15 12:25:54.282 XXX[36890:207] NSFetchedResultsChangeInsert: row:44 section:0 2009-11-15 12:25:54.283 XXX[36890:207] NSFetchedResultsChangeInsert: row:51 section:0 2009-11-15 12:25:54.283 XXX[36890:207] NSFetchedResultsChangeInsert: row:9 section:0 2009-11-15 12:25:54.283 XXX[36890:207] NSFetchedResultsChangeInsert: row:29 section:0 2009-11-15 12:25:54.284 XXX[36890:207] NSFetchedResultsChangeInsert: row:64 section:0 2009-11-15 12:25:54.284 XXX[36890:207] NSFetchedResultsChangeInsert: row:22 section:0 2009-11-15 12:25:54.284 XXX[36890:207] NSFetchedResultsChangeInsert: row:25 section:0 2009-11-15 12:25:54.285 XXX[36890:207] NSFetchedResultsChangeInsert: row:57 section:0 2009-11-15 12:25:54.285 XXX[36890:207] NSFetchedResultsChangeInsert: row:50 section:0 2009-11-15 12:25:54.286 XXX[36890:207] NSFetchedResultsChangeInsert: row:13 section:0 2009-11-15 12:25:54.286 XXX[36890:207] NSFetchedResultsChangeInsert: row:8 section:0 2009-11-15 12:25:54.287 XXX[36890:207] NSFetchedResultsChangeInsert: row:61 section:0 2009-11-15 12:25:54.287 XXX[36890:207] NSFetchedResultsChangeInsert: row:15 section:0 2009-11-15 12:25:54.287 XXX[36890:207] NSFetchedResultsChangeInsert: row:53 section:0 2009-11-15 12:25:54.288 XXX[36890:207] NSFetchedResultsChangeInsert: row:37 section:0 2009-11-15 12:25:54.288 XXX[36890:207] NSFetchedResultsChangeInsert: row:34 section:0 2009-11-15 12:25:54.288 XXX[36890:207] NSFetchedResultsChangeInsert: row:52 section:0 2009-11-15 12:25:54.289 XXX[36890:207] NSFetchedResultsChangeInsert: row:58 section:0 2009-11-15 12:25:54.289 XXX[36890:207] NSFetchedResultsChangeInsert: row:4 section:0 2009-11-15 12:25:54.290 XXX[36890:207] NSFetchedResultsChangeInsert: row:41 section:0 2009-11-15 12:25:54.290 XXX[36890:207] NSFetchedResultsChangeInsert: row:49 section:0 2009-11-15 12:25:54.290 XXX[36890:207] NSFetchedResultsChangeInsert: row:39 section:0 2009-11-15 12:25:54.291 XXX[36890:207] NSFetchedResultsChangeInsert: row:26 section:0 2009-11-15 12:25:54.291 XXX[36890:207] NSFetchedResultsChangeInsert: row:20 section:0 2009-11-15 12:25:54.291 XXX[36890:207] NSFetchedResultsChangeInsert: row:1 section:0 2009-11-15 12:25:54.292 XXX[36890:207] NSFetchedResultsChangeInsert: row:21 section:0 2009-11-15 12:25:54.292 XXX[36890:207] NSFetchedResultsChangeInsert: row:65 section:0 2009-11-15 12:25:54.293 XXX[36890:207] NSFetchedResultsChangeInsert: row:38 section:0 2009-11-15 12:25:54.293 XXX[36890:207] NSFetchedResultsChangeInsert: row:59 section:0 2009-11-15 12:25:54.293 XXX[36890:207] NSFetchedResultsChangeInsert: row:47 section:0 2009-11-15 12:25:54.294 XXX[36890:207] NSFetchedResultsChangeInsert: row:28 section:0 2009-11-15 12:25:54.294 XXX[36890:207] NSFetchedResultsChangeInsert: row:3 section:0 2009-11-15 12:25:54.295 XXX[36890:207] NSFetchedResultsChangeInsert: row:55 section:0 2009-11-15 12:25:54.295 XXX[36890:207] NSFetchedResultsChangeInsert: row:23 section:0 2009-11-15 12:25:54.295 XXX[36890:207] NSFetchedResultsChangeInsert: row:56 section:0 2009-11-15 12:25:54.296 XXX[36890:207] NSFetchedResultsChangeInsert: row:40 section:0 2009-11-15 12:25:54.296 XXX[36890:207] NSFetchedResultsChangeInsert: row:16 section:0 2009-11-15 12:25:54.296 XXX[36890:207] NSFetchedResultsChangeInsert: row:6 section:0 2009-11-15 12:25:54.297 XXX[36890:207] NSFetchedResultsChangeInsert: row:60 section:0 2009-11-15 12:25:54.297 XXX[36890:207] NSFetchedResultsChangeInsert: row:17 section:0 2009-11-15 12:25:54.298 XXX[36890:207] NSFetchedResultsChangeInsert: row:11 section:0 2009-11-15 12:25:54.298 XXX[36890:207] NSFetchedResultsChangeInsert: row:33 section:0 2009-11-15 12:25:54.298 XXX[36890:207] NSFetchedResultsChangeInsert: row:19 section:0 2009-11-15 12:25:54.299 XXX[36890:207] NSFetchedResultsChangeInsert: row:46 section:0 2009-11-15 12:25:54.299 XXX[36890:207] NSFetchedResultsChangeInsert: row:36 section:0 2009-11-15 12:25:54.299 XXX[36890:207] NSFetchedResultsChangeInsert: row:42 section:0 2009-11-15 12:25:54.300 XXX[36890:207] NSFetchedResultsChangeInsert: row:18 section:0 2009-11-15 12:25:54.300 XXX[36890:207] NSFetchedResultsChangeInsert: row:48 section:0 2009-11-15 12:25:54.301 XXX[36890:207] NSFetchedResultsChangeInsert: row:43 section:0 2009-11-15 12:25:54.301 XXX[36890:207] NSFetchedResultsChangeInsert: row:0 section:0 2009-11-15 12:25:54.301 XXX[36890:207] NSFetchedResultsChangeInsert: row:10 section:0 2009-11-15 12:25:54.302 XXX[36890:207] NSFetchedResultsChangeInsert: row:32 section:0 2009-11-15 12:25:54.302 XXX[36890:207] NSFetchedResultsChangeInsert: row:35 section:0 2009-11-15 12:25:54.302 XXX[36890:207] NSFetchedResultsChangeInsert: row:24 section:0

//finish update //tableview crashed

2009-11-15 12:25:54.303 XXX[36890:207] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (65) beyond bounds (1)' 2009-11-15 12:25:54.303 XXX[36890:207] Stack: ( 32556123, 2434330441, 32640059, 32639898, 2149577, 1745447, .. )

**My tableview crashed. Also, I don't call reloadData in my code.

Bud if I reload data after I finish update, and ignore all update events from FetchResultsControllerDelegate, everything works fine. Please help!

A: 

This is a bug, Please read https://devforums.apple.com/message/118418#118418

Stevennie
A: 

I cannot login to the Forums, even though I have joined the dev program. ALways get the error: "There was an error processing your request. If this issue persists, please contact us. Return to Developer Forums Home or Logout"

Would you mind posting what the bug is, and what the fix is?

jp
A: 

okay, so when nsfetchedresultscontroller want to insert multiple sections, it will send call both insert new sections and insert new rows in that new sections to its delegate; however, tableview only want the insert new sections. To solve this, we need to create a set which has all the new sections. When we insert new row, you can tell whether we should insert or now.

Steven