How to correctly configure path for the Realm DB-file (.realm) in iOS project?

前端 未结 2 1703
南笙
南笙 2021-01-23 14:34

Sorry for my english.

I have developed a mobile application that needs its own local data store. I chose Realm as the database management system. In the process of study

相关标签:
2条回答
  • 2021-01-23 15:03

    1) and 2) does have very small effect on security and data integrity 3) if you are worry about security of you data, use Realm-level encryption like here

    0 讨论(0)
  • 2021-01-23 15:04

    When you don't specify a path for the default Realm in your app, Realm will automatically create one named default.realm in the Documents directory of your app. On apps running in the iOS Simulator, this will save the Realm file in the appropriate Simulator folder, but you are correct in that it's not very intuitive to find it.

    In response to your questions:

    1. There is a cool utility called SimPholders that lets you inspect the Documents folders of apps in the iOS Simulator. This is the best way to get at any Realm files the Simulator has generated very quickly.

    2. When creating an instance of a Realm object, you can supply a Configuration object to customise it. You can explicitly set the file path of the Realm file by setting the path property of that Configuration object.

    3. iOS supplies an automatic layer of file encryption on disk, that makes files unable to be read when the device is locked. If you want additional security, then it's possible to set the encryptionKey property of a Realm Configuration object to have a Realm itself encrypt that Realm file on disk.

    I hope that helped! Let me know if you need any more clarification!

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