Finally, I found a solution for 'database disk image is malformed'.
I renamed these files
before
- Documents/.appname.sqlite.migrationdestination_xxxx
- Documents/.appname.sqlite.migrationdestination_xxxx-shm
- Documents/.appname.sqlite.migrationdestination_xxxx-wal
after
- Documents/appname.sqlite
- Documents/appname.sqlite-shm
- Documents/appname.sqlite-wal
I deleted old appname.sqlite, appname.sqlite-shm, appname.sqlite-wal files.
I guessed why this error happens.
Maybe user has succeeded migration.
So there are two sql files. appname.sqlite and .appname.sqlite.migrationdestination_xxxx.
Then iOS is going to exchange these files, but if app is killed by some reason, appname.sqlite remains in the middle of deleting.
but app look appname.sqlite every time, then iOS guess wrong it's corrupted, so my app can't run.
Now i'm going to make these exchange script and apply my app.
Thank you for listing my issue.