I used realm base on flutter, I insert data into realm and found error
libc++abi: terminating with uncaught exception of type realm::util::DecryptionFailed: Decryption failed: 'unable to decrypt after 0 seconds (retry_count=2, from=iv1 == 0, size=16384)'
* thread #9, name = 'io.flutter.1.ui', stop reason = signal SIGABRT
frame #0: 0x00000001ddf67160 libsystem_kernel.dylib`__pthread_kill + 8
-> 0x1ddf67160 <+8>: b.lo 0x1ddf67180 ; <+40>
0x1ddf67164 <+12>: pacibsp
0x1ddf67168 <+16>: stp x29, x30, [sp, #-0x10]!
0x1ddf6716c <+20>: mov x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
Please help to resolve this error
We will be glad if you could share more details about you code.
Have you set an encryption key into your Configuration?
My code for setup Realm
var config = Configuration.local(
shouldCompactCallback: (_forServer ? (totalSize, usedSize) => true : null),
Realm realm = Realm(config);
I set encryption key into my Configuration. and I can query data too.
@Chakrachai_Klinfung thanks for the sample code. It looks correct to me.
I suppose you receive this error:
Realm file decryption failed (Decryption failed: 'unable to decrypt after 0 seconds (retry_count=4........').
If yes, this means that the file that you try to open is encrypted with a different key.
Once you create a Realm file with one encryptionKey, later it can be opened and used only with the same encryptionKey. Probably, you already have an existing realm file on this location, that have been created with another encryptionKey.
I hope this will help to fix your problem.
Thank for support me.
I’m not sure this problem from my usecase
- I create realm from linux server with encrypt key.
- copy this realm into ios device.
- connect realm with this encrype key same server
- insert data
- found app crash
Yes, cross-platform encryption could be the thing that causes the issue. We have an ticket opened about this, where you can find more information. I would suggest you to find some workaround. Try to encrypt the realm using an app built on the same architecture as the one that you use for the decryption.