Cocoa error 512 - anybody else?


I’ve been trying to debug this issue for a while now, but the last section where you store information to a local database seems to be giving me a problem. It crashes out here:

    if (![psc addPersistentStoreWithType:NSSQLiteStoreType
            [NSException raise:@"Open failed"
                        format:@"Reason: %@", [error localizedDescription]];

And the error is:

Nerdfeed[14975:907] *** Terminating app due to uncaught exception ‘Open failed’, reason: ‘Reason: The operation couldn’t be completed. (Cocoa error 512.)’
*** First throw call stack:

I think it has something to do with the path used for the database:

dbPath = [dbPath stringByAppendingPathComponent:@“feed.db”];

I have tried deleting the app, running it again, running it on a simulator etc… nothing seems to work.

anybody have any tips or things i can look into?


Do an NSLog on the dbPath to make sure that path is present. Make sure the path is pointing to NSDocumentDirectory and NOT NSDocumentationDirectory (read it closely). If it’s ‘Documentation’ then you can’t write to that directory and will get 512 error.

    NSString *dbPath =
                                             YES) objectAtIndex:0];
    dbPath = [dbPath stringByAppendingPathComponent:@"feed.db"];


Thanks, it was the typo error of NSDocumentDirectory.

Much appreciated!


That fixed my issue as well. Thank you sir!


Same here. NSDocumentationDirectory

Thanks for tracking this down for us :slight_smile:


Same for me! Thanks so much!!


Thanks so much!