Problems creating a realm on macOS Mojave


#1

I’m evaluating Realm for use in a multiplatform application. I’ve immediately run into a problem creating realm objects in the Objective-C code for the macOS app.

I’m using XCode 10.0 (10A255) on the release version of Mojave (macOS 10.14).

In the init method of my app delegate, I use the NSFileManager to get the Application Support directory, and then obtain the appropriate subdirectory for my app.

I then use [RLMRealm realmWithURL:] to create a realm object that points to the appropriate file URL within the app’s support directory.

If the app subdirectory does not exist, then the call to realmWithURL creates and returns an RLMRealm object. It also creates the app’s subdirectory and populates it with a file at the pathname that I gave to realmWithURL, and a lock file with the same name plus “.lock”. It creates a subdirectory named for the supplied path plus “.management”, containing a couple of “.mx” files.

The app then signals an exception:

2018-09-25 10:05:45.667230-0500 Delectus[1039:42174] [default] Unable to load Info.plist exceptions (eGPUOverrides)

The app then continues about its business, presenting its normal UI, and working as expected.

If I quit the app, delete the application support directory that it created, and then rerun it, it reproduces the same behavior.

If, on the other hand, I quit and rerun without deleting the application support directory, it sometimes crashes in RLMRealm notification listener, exhibiting the same message about being unable to load Info.plist exceptions.

My questions are two:

  1. How do I properly load Info.plist exceptions?

  2. What am I doing wrong to cause Realm to sometimes fail to correctly create a realm object, and instead crash in the notification listener?

I assume I’m overlooking some important initialization steps that were not obvious to me from the sample code.

Thanks for any help.