06 Oct 2012, 00:47
Ff_150x150_pragsmall

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
Ff_150x150_pragsmall

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’
  • First throw call stack:
    (0×1c99012 0×10d6e7e 0×1c98e78 0xb6cf35 0xbdec7 0xcc846 0xcc885 0×3e9a 0×4da5 0×10ea705 0×21920 0×25db24 0×10ea705 0×21920 0×218b8 0xe2671 0xe2bcf 0xe1d38 0×5133f 0×51552 0×2f3aa 0×20cf8 0×1bf4df9 0×1bf4ad0 0×1c0ebf5 0×1c0e962 0×1c3fbb6 0×1c3ef44 0×1c3ee1b 0×1bf37e3 0×1bf3668 0×1e65c 0×1ced 0×1c15)
    libc++abi.dylib: terminate called throwing an exception
    (lldb)

Something stinks and I don’t know what it is. Everything was working fine before this chapter. :-(

06 Oct 2012, 00:53
Ff_150x150_pragsmall

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
Ff_150x150_pragsmall

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
Generic-user-small

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


- (NSMutableArray *)recipes {
    if (!_recipes) {
        self.recipes = [NSMutableArray array];
    }
    return _recipes;
}

01 Dec 2012, 22:12
Mangatar_db_pragsmall

David Bourguignon (1 post)

Ok I got the same problem.

Daniel solution worked well.
I guess some update on the book would be good.

11 Dec 2012, 22:32
Generic-user-small

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
Clus

11 Apr 2013, 17:08
Jeff_pragsmall

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