Best practices for core data store (sqlite) backup?

前端 未结 1 2026

I am working on an update for my new iphone app which will include the ability to back up & restore the Core Data store (SQLite). I have been looking for good options for ho

1条回答
  •  逝去的感伤
    2021-02-06 19:26

    If you just want to do a backup, copy the sqlite file to another location. If you are looking for something more complicated, please update your question with the specific requirements.

    Update

    What other sort of more complicated options are available? I haven't see anyone do much besides actually copying the sqlite file.

    Everything. You can integrate with the DropBox API and copy the file there. You can push changes to a REST service on a server, you can build a connection to MobileMe and push a copy there, you can translate it to JSON and push it anywhere. You can fax it to someone.

    You could even set up a multi-file backup strategy that goes back six months: hourly for 24 hours, daily for 7 days, weekly for 4 weeks and monthly forever.

    How you back up is an implementation detail. Core Data is open enough that you can translate it into any format you want and push it anywhere you want. It all depends on how much effort you want to put into it and where do you want to go with it.

    0 讨论(0)
提交回复
热议问题