Brian W


Reactive Extensions for .NET in an iOS share extension

One of the applications we’re building makes use of Reactive Extensions for .NET in an iOS share extension.

We had encountered the share extension closing when being run on a real device rather than it working as it did when run via the iOS simulator. The error was: “error: Failed to load AOT module ‘/private/var/containers/Bundle/Application/{id}/{app}/’ in aot-only mode.”

The first step was to diagnose if the linker was removing the reference, so I tried setting the Linker Behavior to “Don’t Link” in the share extension project and in the container application project. Clean and rebuild. The same error occurred.

After much fiddling, the accidental discovery that by adding: System.Reactive.PlatformServices.EnlightenmentProvider.EnsureLoaded(); allowed the share extension to load and run on the actual device. The summary describes it best:

EnlightmentProvider [from metadata]

Thought I would put the notes up somewhere for the next time I search for “’ in aot-only mode.” which I didn’t have much luck with this past week ;)

Topics of interest

More Related Stories