Bugs:
The realm file can't be opened anymore after upgrading from iOS 13 to iOS 14 for a lot of our users.
If the app is re-installed on iOS 14 (the realm file is re-created), the file can be accessed again.
It seems that the issue can only be reproduced with the store or ad-hoc build.
The app was using 5.4.6. I upgraded realm to 10.1.2. Unfortunately, the issue still occurs.
Realm can be opened. (The Realm object can be initialized.)
Unable to open a realm at path '/var/mobile/Containers/Data/Application/FB934414-857D-4992-A081-FD04238527BB/Documents/AppData.realm': Realm file initial open failed Path:Exception backtrace:
0 MyApp PROD 0x0000000102ab1ac4 _Z23RLMAddNotificationBlockI10RLMResultsEP20RLMNotificationTokenPT_U13block_pointerFvP11objc_objectP19RLMCollectionChangeP7NSErrorEPU28objcproto17OS_dispatch_queue8NSObject + 766844
1 MyApp PROD 0x0000000102b39980 _ZNK5realm5Array4findINS_4LessELNS_6ActionE0ELm64EEEbxmmmPNS_10QueryStateIxEE + 483360
2 MyApp PROD 0x0000000102b3bed0 _ZNK5realm5Array4findINS_4LessELNS_6ActionE0ELm64EEEbxmmmPNS_10QueryStateIxEE + 492912
3 MyApp PROD 0x0000000102b3f590 _ZNK5realm5Array4findINS_4LessELNS_6ActionE0ELm64EEEbxmmmPNS_10QueryStateIxEE + 506928
4 MyApp PROD 0x00000001029997bc MyApp PROD + 694204
5 MyApp PROD 0x0000000102998b88 MyApp PROD + 691080
6 MyApp PROD 0x00000001029989f4 MyApp PROD + 690676
7 MyApp PROD 0x00000001029dc210 _ZN5realm7Results8index_ofINS_4util8OptionalINS_8ObjectIdEEEEEmRKT_ + 58460
8 MyApp PROD 0x0000000102a8cbb0 _Z23RLMAddNotificationBlockI10RLMResultsEP20RLMNotificationTokenPT_U13block_pointerFvP11objc_objectP19RLMCollectionChangeP7NSErrorEPU28objcproto17OS_dispatch_queue8NSObject + 615528
9 MyApp PROD 0x0000000102c6387c _ZNK5realm5Table10find_firstINS_4util8OptionalIxEEEENS_6ObjKeyENS_6ColKeyET_ + 301044
10 MyApp PROD 0x000000010296f050 MyApp PROD + 520272
11 MyApp PROD 0x000000010296ec64 MyApp PROD + 519268
12 MyApp PROD 0x0000000102942bec MyApp PROD + 338924
13 MyApp PROD 0x0000000102946e50 MyApp PROD + 355920
14 MyApp PROD 0x0000000102942ae8 MyApp PROD + 338664
15 MyApp PROD 0x00000001028ffd00 MyApp PROD + 64768
16 MyApp PROD 0x00000001028ff9d8 MyApp PROD + 63960
17 MyApp PROD 0x00000001028ff860 MyApp PROD + 63584
18 MyApp PROD 0x0000000102d11538 _ZNK5realm5Table10find_firstINS_4util8OptionalIxEEEENS_6ObjKeyENS_6ColKeyET_ + 1012912
19 UIKitCore 0x000000019429d1e4 05147936-B875-3EF3-94DB-9C8869BB0E34 + 12460516
20 UIKitCore 0x000000019370c614 05147936-B875-3EF3-94DB-9C8869BB0E34 + 333332
21 UIKitCore 0x000000019370d7dc 05147936-B875-3EF3-94DB-9C8869BB0E34 + 337884
22 UIKitCore 0x0000000193d81d0c 05147936-B875-3EF3-94DB-9C8869BB0E34 + 7105804
23 FrontBoardServices 0x00000001a0bddd54 E22FDD4D-3F20-3D60-A568-E82AE2B4151C + 44372
24 FrontBoardServices 0x00000001a0c0a5c4 E22FDD4D-3F20-3D60-A568-E82AE2B4151C + 226756
25 FrontBoardServices 0x00000001a0bec560 E22FDD4D-3F20-3D60-A568-E82AE2B4151C + 103776
26 FrontBoardServices 0x00000001a0c0a4f0 E22FDD4D-3F20-3D60-A568-E82AE2B4151C + 226544
27 libdispatch.dylib 0x00000001914c8db0 3277BF1E-B994-3609-9B30-E0186BBF3C25 + 15792
28 libdispatch.dylib 0x00000001914cc738 3277BF1E-B994-3609-9B30-E0186BBF3C25 + 30520
29 FrontBoardServices 0x00000001a0c31310 E22FDD4D-3F20-3D60-A568-E82AE2B4151C + 385808
30 FrontBoardServices 0x00000001a0c30fa0 E22FDD4D-3F20-3D60-A568-E82AE2B4151C + 384928
31 FrontBoardServices 0x00000001a0c314f4 E22FDD4D-3F20-3D60-A568-E82AE2B4151C + 386292
32 CoreFoundation 0x000000019185076c AF3F8E01-C130-3464-AD40-C5532D273483 + 661356
33 CoreFoundation 0x0000000191850668 AF3F8E01-C130-3464-AD40-C5532D273483 + 661096
34 CoreFoundation 0x000000019184f960 AF3F8E01-C130-3464-AD40-C5532D273483 + 657760
35 CoreFoundation 0x0000000191849a8c AF3F8E01-C130-3464-AD40-C5532D273483 + 633484
36 CoreFoundation 0x000000019184921c CFRunLoopRunSpecific + 600
37 GraphicsServices 0x00000001a88c8784 GSEventRunModal + 164
38 UIKitCore 0x0000000194282200 05147936-B875-3EF3-94DB-9C8869BB0E34 + 12349952
39 UIKitCore 0x0000000194287a74 UIApplicationMain + 168
40 MyApp PROD 0x00000001028febc4 MyApp PROD + 60356
41 libdyld.dylib 0x00000001915096c0 BA60CB9E-95C5-3646-BEED-D313E15586CF + 5824.
Mysterious, only happens after upgrading from iOS 13 to iOS 14.
private static func getRealmConfig() throws -> Realm.Configuration {
var config = Realm.Configuration()
// Filename
config.fileURL = config.fileURL!.deletingLastPathComponent().appendingPathComponent("\(Constants.Storage.realmFilename).realm")
return config
}
private static func getRealm() throws -> Realm {
let config = try getRealmConfig()
return try Realm(configuration: config)
}
This is something that came to my mind while I am writing this issue report. I am going to do a test.
I have another project where I also use Realm (one of my favorite library). And I don't have any users that cannot open their database file.
In that project, unlike the code above, I change the default configuration at launch and always use the default realm object.
Realm framework version: 5.4.6, 10.1.2
Xcode version: 11.7 and 12.2
iOS version: from 13.7 to 14.2
Dependency manager: SPM
Hi @cedric-elca
Is it an encrypted Realm? It could be a wrong encryption key.
Hello, the realm file is not encrypted.
Some additional info:
Hello, you are right, these realm files are encrypted! This is a big mistake on our side, I apologize.
We have some very early users that have their realm files encrypted. In a recent library update, the optional decryption code was mistakenly removed. Sorry again.
Most helpful comment
Hello, you are right, these realm files are encrypted! This is a big mistake on our side, I apologize.
We have some very early users that have their realm files encrypted. In a recent library update, the optional decryption code was mistakenly removed. Sorry again.