Realm crash in iPhone X, permission issues


Hi Realm Team,

First of all thanks for providing such a robust DB library for the mobile platform.

I want your help in debugging a crash which is happening a lot for past few days

It is mostly happening in iPhoneX device with {iOS 12.2.0, 12.3.1}.
It seems to be having some permission issues while accessing the primary Realm DB.
Following is the detail of the crash provided by Fabric Crashlytics:

Fatal error: ‘try!’ expression unexpectedly raised an error: Error Domain=io.realm Code=2 “Unable to open a realm at path ‘/var/mobile/Containers/Data/Application/DF0CC44C-45BC-4212-B354-8266BA1BC044/Documents/realm/default.realm.lock’: open() failed: Operation not permitted.” UserInfo={Error Code=2, NSFilePath=/var/mobile/Containers/Data/Application/DF0CC44C-45BC-4212-B354-8266BA1BC044/Documents/realm/default.realm.lock, Underlying=open("/var/mobile/Containers/Data/Application/DF0CC44C-45BC-4212-B354-8266BA1BC044/Documents/realm/default.realm.lock") failed: Operation not permitted, NSLocalizedDescription=Unable to open a realm at path ‘/var/mobile/Containers/Data/Application/DF0CC44C-45BC-4212-B354-8266BA1BC044/Documents/realm/default.realm.lock’: open() failed: Operation not permitted.}: file /BuildRoot/Library/Caches/, line 184

Please assist me on debugging this issue as soon as you guys can do.


It seems that you are using force try somewhere.
I would definitelly check those out, and if i can then change it to a try - catch block.