I'm using the cedar testing framework and trying to run the tests from command line. The build crashes with this error:
Unresolved error Error Domain=NSCocoaErrorDomain Code=512 "The operation couldn’t be completed. (Cocoa error 512.)" UserInfo=0x6c5c6c0 {reason=Failed to create file; code = 2}, {
reason = "Failed to create file; code = 2";
}
The tests run from xcode without any problems, I just can't get them to work from command line. Any ideas? Thanks
I had the same problem with Unit-Tests and Core Data:
First I ran into "Can't find model for store". I fixed this using this thread: Error running 'Cedar' unit tests from command line
Second I got the same error: "Failed to create file; code = 2"
Then I looked at the URLs and saw that:
The URL for the NSPersistentStoreCoordinator and the NSManagedObjectModel are quite diffrent. But only when I do Unit-Testing and only after fixing the first error.
Usually the model is in "/some/path/<DataModelFile>.app/<DataModel>.momd/
The sqlite is in "some/path/Documents/<SQLiteFile>.sqlite
So I use the following code to get the correct URLs in both testing and running:
If I remember right then I had to create the "Documents" folder where the sqlite file is stored.
Any comments / suggestions if this works for you or how to do it better are appreciated.