0

I'm using SQLCipher to encrypt my database as there's sensitive information. Everything seems to work, I'm just irritated because I've got two .sqlite-files right now:

~/Library/Application Support/MyData.sqlite
~/Library/Application Support/MyApp/MyData.sqlite
~/Library/Application Support/MyApp/MyData.sqlite-shm
~/Library/Application Support/MyApp/MyData.sqlite-wal

The first one is encrypted, the second isn't - but it doesn't contain any information. So it seems to work as there's no way to get to the information, but I just wanted to ensure that this is correct.

Tom Zych
  • 13,329
  • 9
  • 36
  • 53
swalkner
  • 16,679
  • 31
  • 123
  • 210
  • What are shm and wal files it was already explained many times. Duplicate eg: http://stackoverflow.com/questions/18870387/core-data-and-ios-7-different-behavior-of-persistent-store – thom_ek Mar 24 '14 at 11:50
  • yes, I don't care much about the shm- and wal-files, but more on the two .sqlite-files, i.e. - why are there two sqlite files? – swalkner Mar 24 '14 at 12:05
  • 1
    If you delete the app from the simulator and then reinstall it, do you get two `.sqlite` files every time? – Tom Harrington Mar 24 '14 at 22:40
  • That does not seem correct. The -shm and -wal files are from WAL and can safely be ignored. However, that doesn't explain the existence of 2 different MyData.sqlite databases. @swalkner does the first database contain any data? What are the datestamps on the files? Are you sure one isn't left over from before you were using SQLCipher? – Stephen Lombardo Mar 26 '14 at 13:35
  • Are both your app and Core Data model called MyData? At least with encrypted-core-data (which uses SQLCipher) you will see an empty (schema only) database for each model with the model name and another db which will contain all the encrypted data named as the project itself (ie. model1.sqlite, model2.sqlite, Project.sqlite). – momo Nov 03 '15 at 13:23

1 Answers1

-1

You'll need to turn off the Write Ahead Logging feature of sqlite. To do this in Core Data, you need to set a pragma option on your store. You can see how to set the flag from this related stackoverflow question

Community
  • 1
  • 1
casademora
  • 67,775
  • 17
  • 69
  • 78