I installed the latest version of Monotouch and I started seeing the following error when I try to deploy my build to the device.
Error MT4112: The registrar found an invalid type The generic type argument 'T' must have a reference type constraint in order to be exportable to ObjectiveC. (MT4112)
It looks like I need to add a where clause in the class here, but it doesn't seem to work in Monotouch.
public class NotificationObject<T> : NSObject
{
public T Data { get; set; }
}
This is a known issue in MonoTouch 6.0.2.
Note that creating generic subclasses of NSObject, or exporting generic classes to ObjectiveC, is not supported. It may work, or it may crash inexplicably and randomly.
We do plan to support at least some scenarios of exported generic classes in the future, but it is not on the immediate roadmap, so there is no timeline yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With