![]() | Cap. 7: attempt to insert row 0 into section 0, but there are only 0 rows in section 0 after the update |
|
06 Oct 2012, 00:47
Fernando Fernandes (6 posts) |
This is after tapping the “DONE” button (to add a new recipe). What I am missing? Thanks. |
|
06 Oct 2012, 00:49
Fernando Fernandes (6 posts) |
The complete stack trace: 2012-10-05 21:47:24.342 StoryboardRecipes[14234:3b03] Foundation called mkdir(”/Users/Fernando/Library/Application Support/iPhone Simulator/6.0/Applications/735F6756-D5BC-416F-9267-9FE273DBE77F/Library/Documentation/(A Document Being Saved By StoryboardRecipes)”), it didn’t return 0, and errno was set to 2.2012-10-05 21:47:24.549 StoryboardRecipes[14234:c07] Failed to create file 2012-10-05 21:47:24.580 StoryboardRecipes[14234:c07] Failed to open document 2012-10-05 21:47:34.321 StoryboardRecipes[14234:c07] * Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:909 2012-10-05 21:47:34.322 StoryboardRecipes[14234:c07] * Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘attempt to insert row 0 into section 0, but there are only 0 rows in section 0 after the update’
Something stinks and I don’t know what it is. Everything was working fine before this chapter. :-( |
|
06 Oct 2012, 00:53
Fernando Fernandes (6 posts) |
Should I initialise ”@property(nonatomic, strong) NSMutableArray *recipes;” (in PRPRecipesDocument.m)? If yes, where I should initialise it? |
|
06 Oct 2012, 01:10
Fernando Fernandes (6 posts) |
Ok, if I put: _recipes = [[NSMutableArray alloc] init]; ... in initWithFileURL() of PRPRecipes document, it works. Now the question is: is this the right way to solve the problem? |
|
14 Nov 2012, 21:46
Daniel Lunde (1 post) |
I just ran into this same problem. When I compared my code vs. code provided by the authors, I noticed they added a method to override the getter for recipes in PRPRecipeDocument.m
|
|
01 Dec 2012, 22:12
David Bourguignon (1 post) |
Ok I got the same problem. Daniel solution worked well. |
|
11 Dec 2012, 22:32
Claus Guttesen (3 posts) |
Thank you. The app works. This post also helped me when xcode’s autocomplete wrote NSDocumentationDirectory rather than NSDocumentDirectory. http://stackoverflow.com/questions/13103413/fou… regards |
|
11 Apr 2013, 17:08
Jeff Chang (3 posts) |
Thanks for the tip Daniel, that did the trick for me. Fernando: Usually I do the creation of objects to back the property in the inits, but the book was showing us a different way called lazy create (pg. 98). That is why I missed it. |
| You must be logged in to comment |

