0

I set up my working Core Data sqlite file for versioning. The versioning setup process created 3 files:

  • foo.sqlite
  • foo.sqlite-shm
  • foo.sqlite-wal

Since then, I can access the Core Data store programmatically (using MagicalRecord), but I can't read any data using either the Firefox add-in (SQLite Manager) or the app SQLiteManager. I'm concerned that when I send the updated app to the App Store, the additional files are not going to go and the app is going to crash.

What do I need to do to make sure new versioning-enabled sqlite files go with the app?

2 Answers 2

1

Those are not version-related files, they're SQLite log files. These files get created automatically when write-ahead logging is enabled. That's not the default in iOS 6, but it's possible if you use PRAGMA journal_mode=WAL;. It might or might not be the default in iOS 7 (I have no comment at this time).

I don't know why Firefox and SQLiteManager can't open the file. I speculate that they're both using an old version of SQLite (since WAL is only available as of SQLite 3.7.0). Regardless, they have nothing to do with whether the necessary files are available in your app. You can find out what's included in the app by just looking. The .app is just a directory, really, so take a look inside and see what's there.

3
  • Hi Tom... I don't have an .app; what I have is an .ipa. Is there anyway to see what's inside the .ipa? Aug 14, 2013 at 15:45
  • If you're the one building the app, you can get a .app any time you want from Xcode. You can open an ipa using unzip-- it's just a zip archive-- but you should already have the .app available, because it's necessary to have that to create an ipa. Aug 14, 2013 at 16:03
  • Interesting... I've never done that before... anyway, there doesn't appear to be a CoreData store anywhere in my .app file. And the Archive utility won't even show a window, although it appears on the dock. Aug 14, 2013 at 20:29
0

If you are using lightweight migration (wich is enabled by passing the right options when you open the store), Core Data takes care of upgrading the schema in-place.

The additional WAL and SHM files are not a result of lightweight migration, but are instead simply produced by SQLite in the “write ahead logging” mode that Core Data puts it into. (An oversimplification is that new data goes into the .wal file until enough accumulates and then it is moved to the .sqlite file.)

Yes, you definitely want to test using Ad Hoc builds for lightweight migration; testing from Xcode is insuffient.

Mike Fikes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.