I am writing a shoebox type application wherein a user enters data into a single window. I’ve configured the data model with Code Data. Apple’s documentation states that user data should be stored in a Library Directory, however the auto-generated code seems to make a directory in the Application Support directory where one, the documentation also states, “should never store user data.” Which is correct? The other question I have is should I not create an instance of NSPersistentDocument in the applicationDidFinishLaunching method?
Asked
Active
Viewed 71 times
0
-
"however the auto-generated code seems to make a directory in the Application Support". If you are referring to the comments in the Core Data template, no, it does not do that. – quellish Jan 08 '15 at 00:53
-
I'm referring to this line of code:NSURL *appSupportURL = [[[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask] lastObject]; – Scott Henderson Jan 10 '15 at 05:34
1 Answers
0
User-created data should be managed by the user: the user should decide where they are saved, etc.
Application-created data would indeed belong in the application support directory. If your application creates an NSPersistentDocument without user intervention, this would be the correct place to store it. For example, if you were using NSPersistentDocument to manage application data it would belong in a sandboxed directory such as NSApplicationSupportDirectory.
The File System Programming Guide goes into this in more detail.

quellish
- 21,123
- 4
- 76
- 83