EDIT:
A couple of years later, things are easier. It is now possible to omit the
Register()
attributes, both on the application and the app delegate and instead use:
UIApplication.Main(args, typeof(CustomApp), typeof(CustomAppDelegate));
In order to be able to override UIApplication.SendEvent() I want to subclass UIApplication:
public class UIApplicationMain : UIApplication
{
public UIApplicationMain () : base()
{
}
public override void SendEvent (UIEvent uievent)
{
base.SendEvent (uievent);
}
}
In the main.cs I use this code:
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args, "UIApplicationMain", "AppDelegateBase");
}
}
But it fails with:
Objective-C exception thrown. Name:
NSInternalInconsistencyException Reason: Unable to instantiate the UIApplication subclass instance. No class named UIApplicationMain is loaded.
So I'm missing some attributes I guess. But what and where?
Add a [Register] attribute to your new type, like:
[Register ("UIApplicationMain")]
public class UIApplicationMain : UIApplication {
...
That will allow the native side to instantiate the right type when Main gets executed.
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