2

I am creating a Xamarin.iOS binding library for AdaptiveCards. It works correctly on iOS simulator. However, when running on a real iOS device I get the following error: Can't register the class AdaptiveCardsBinding.iOS.ACOHostConfig when the dynamic registrar has been linked away.

I have read this documentation about linker behaviour and tried the following solutions:

  1. Set linker behaviour to Don't Link in the referencing iOS app. This works but is not efficient/desired
  2. Preferred solution: Preserve code by adding the following attribute on the ACOHostConfig class: [Preserve (AllMembers = true)] This does not fix the problem.
  3. Add mtouch arguments: --linkskip=AdaptiveCardsBinding.iOS. Doesn't work either.

Any ideas on how to fix this?

Niels
  • 1,366
  • 15
  • 21

1 Answers1

4

So as the error indicates, the dynamic registrar has been linked away. This default behavior can be overridden by passing --optimize=[+|-]remove-dynamic-registrar to mtouch

Solution: Add the following mtouch argument: --optimize=-remove-dynamic-registrar

Niels
  • 1,366
  • 15
  • 21