Core Data and iTunes File Sharing - Move/hide the .sqlite file on app update?

回眸只為那壹抹淺笑 提交于 2019-12-23 19:15:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!