IOS Magical Record & SQLCipher

I use Magical Record to save my data. This data requires encryption, so I'm trying to combine it with the SQLCipher library ( http://sqlcipher.net/ios-tutorial/ ).

I already installed SQLCipher and successfully tested it using Core Data using the EncryptedStore file from this example https://github.com/project-imas/encrypted-core-data :

I just changed the NSPersistentStoreCoordinator as follows:

NSPersistentStoreCoordinator * coordinator = [EncryptedStore makeStore: [self managedObjectModel]: [SSKeychain passwordForService: myservice account: myaccount]];

So it seems to me that I need to change the way I create the NSPersistentStoreCoordinator in MagicalRecord, but I'm out of luck, so any help would be appreciated.

+6
source share
1 answer

If you already have a permanent repository coordinator, you will have to manually configure the main data stack when using MagicalRecord. I recommend something in this direction:

NSPersistentStoreCoordinator *coordinator = //how ever you do it; [NSPersistentStoreCoordinator MR_setDefaultCoordinator:coordinator]; [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; 

You may need to open the initialization method yourself.

As an additional note, you may need to add a ticket to the MagicalRecord problem log to add a method to the collection of installation methods, to specify your own coordinator so that this work is done by MagicalRecord itself.

+2
source

Source: https://habr.com/ru/post/952234/


All Articles