问题
I have an iPad app that uses Core Data for data storage. I would like to enable file sharing in iTunes and I don't really want the users to be able to delete or modify the .sqlite file.
Can I move the file to a different, hidden directory?
Alternatively, could the file be made read-only? I wouldn't mind users having access to the file as long as it couldn't be changed.
I suspect there is a trivial solution that is escaping me at the moment.
回答1:
You will want to store the core data data store in one of the recommended directories. If you need to you can then make your data store accessable to users via file sharing in the documents directory by copying it there. There is no way to restrict the user from overwriting or deleting a file or directory (via iTunes file sharing) in the documents directory.
来源:https://stackoverflow.com/questions/4551065/core-data-and-itunes-file-sharing-move-hide-the-sqlite-file-on-app-update