small medium large xlarge

Intoxication_pragsmall
06 Oct 2012, 00:47
Fernando Fernandes (7 posts)

This is after tapping the “DONE” button (to add a new recipe).

What I am missing?

Thanks.

Intoxication_pragsmall
06 Oct 2012, 00:49
Fernando Fernandes (7 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: (0x1c99012 0x10d6e7e 0x1c98e78 0xb6cf35 0xbdec7 0xcc846 0xcc885 0x3e9a 0x4da5 0x10ea705 0x21920 0x25db24 0x10ea705 0x21920 0x218b8 0xe2671 0xe2bcf 0xe1d38 0x5133f 0x51552 0x2f3aa 0x20cf8 0x1bf4df9 0x1bf4ad0 0x1c0ebf5 0x1c0e962 0x1c3fbb6 0x1c3ef44 0x1c3ee1b 0x1bf37e3 0x1bf3668 0x1e65c 0x1ced 0x1c15) 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. :-(

Intoxication_pragsmall
06 Oct 2012, 00:53
Fernando Fernandes (7 posts)

Should I initialise “@property(nonatomic, strong) NSMutableArray *recipes;” (in PRPRecipesDocument.m)? If yes, where I should initialise it?

Intoxication_pragsmall
06 Oct 2012, 01:10
Fernando Fernandes (7 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?

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

- (NSMutableArray *)recipes {
    if (!_recipes) {
        self.recipes = [NSMutableArray array];
    }
    return _recipes;
}
Mangatar_db_pragsmall
01 Dec 2012, 22:12
David Bourguignon (2 posts)

Ok I got the same problem.

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

Generic-user-small
11 Dec 2012, 22:32
Claus Guttesen (5 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/foundation-called-mkdir-it-didnt-return-0-and-errno-was-set-to-2

regards Clus

Jeff_pragsmall
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