问题
I have a SQLite DB that I need to backup using iCloud. I am aware that Apple recommends not to sync the whole DB and it may reject the App. Possible workarounds includes -
1) Switch to Core Data - Its too late for this option and given the learning curve for core date, I do not wish to extend the timelines.
2) Maintain log files for SQLite and Sync the log file - This option is more valid and I would be working on it as a fail-safe
3) Zip the DB using ZipArchive and Sync the zip file - This will be the easiest to implement but I am not sure whether Apple will reject or accept this. The Size before zip was 300kb and after zip it came around 40kb.
Has anyone else tried the zip approach and succesffully submitted their app to appstore?
Any other suggestions would be really helpful.
Thanks
回答1:
Well, strictly that link is talking about syncing a sqlite database on iCloud. You say you're wanting to backup. IF you don't need different devices to have the ability to edit the same database file you might be ok.
However, if you need different devices to have edit access to the 'same' database file (syncing), then it's not possible to use sqlite to do this on iCloud by uploading the actual database file - you will end up with a corrupt database.
You would have to implement your own transaction logging system - where you keep separate databases on each device, and your log files are used to keep them all in sync with each other. This is actually what Apple does for their Core Data syncing solution - the databases only exist on the devices, not in iCloud - only the transaction log files get uploaded to iCloud.
Does anyone know if someone has invented a solution to do this already? It shouldn't be outside the realms of possibility...
Actually, this answers pretty much the same thing I've just done...
来源:https://stackoverflow.com/questions/16580906/possible-app-rejection-by-syncing-zipped-sqlite-database-in-ios