0

I am new to robovm. I'm using Eclipse Juno. I just updated to the latest robovm install. Before the upgrade, the ios demo app would run briefly, and then crash. It only crashes if the code tries to create a UINavigationControllerDelegate.

When I try to create a UINavigationControllerDelegate, I get this exception:

Exception in thread "main" java.lang.UnsupportedOperationException: Cannot create instances of MyNavControllerDelegate
at org.robovm.objc.ObjCObject.alloc(ObjCObject.java)
at org.robovm.objc.ObjCObject.<init>(ObjCObject.java)
at MyNavControllerDelegate.<init>(MyNavControllerDelegate.java)
at IOSDemo.didFinishLaunching(IOSDemo.java)
at org.robovm.apple.uikit.UIApplicationDelegate$ObjCProxy.$cb$application$didFinishLaunchingWithOptions$(Unknown Source)
at org.robovm.apple.uikit.UIApplication.main(Native Method)
at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
at IOSDemo.main(IOSDemo.java)

Below is the implementation of the UINavigationControllerDelegate. The implementation doesn't do anything yet. I just want to test robovm's ability run typical code.

import org.robovm.apple.uikit.UIInterfaceOrientation;
import org.robovm.apple.uikit.UINavigationController;
import org.robovm.apple.uikit.UINavigationControllerDelegate;
import org.robovm.apple.uikit.UINavigationControllerOperation;
import org.robovm.apple.uikit.UIViewController;
import org.robovm.apple.uikit.UIViewControllerAnimatedTransitioning;
import org.robovm.apple.uikit.UIViewControllerInteractiveTransitioning;
import org.robovm.objc.annotation.Method;
import org.robovm.rt.bro.annotation.MachineSizedUInt;

public class MyNavControllerDelegate extends org.robovm.objc.ObjCObject implements UINavigationControllerDelegate  {
    @Override
    @Method(selector = "navigationController:willShowViewController:animated:")
    public void willShowViewController(UINavigationController navigationController, UIViewController viewController, boolean animated) {
    }

    @Override
    @Method(selector = "navigationController:didShowViewController:animated:")
    public
    void didShowViewController(UINavigationController navigationController, UIViewController viewController, boolean animated) {
    }

    @Override
    @Method(selector = "navigationControllerSupportedInterfaceOrientations:")
    @MachineSizedUInt
    public
    long getSupportedInterfaceOrientations(UINavigationController navigationController) {
        return 0;
    }

    @Override
    @Method(selector = "navigationControllerPreferredInterfaceOrientationForPresentation:")
    public
    UIInterfaceOrientation getPreferredInterfaceOrientation(UINavigationController navigationController) {
        return null;
    }

    @Override
    @Method(selector = "navigationController:interactionControllerForAnimationController:")
    public
    UIViewControllerInteractiveTransitioning getInteractionController(UINavigationController navigationController, UIViewControllerAnimatedTransitioning animationController) {
        return null;
    }

    @Override
    @Method(selector = "navigationController:animationControllerForOperation:fromViewController:toViewController:")
    public
    UIViewControllerAnimatedTransitioning getAnimationController(UINavigationController navigationController, UINavigationControllerOperation operation, UIViewController fromVC, UIViewController toVC) {
        return null;
    }
}

1 Answers1

2

Change your MyNavControllerDelegate class so that it extends UINavigationControllerDelegateAdapter instead and remove all your @Method annotations.

ntherning
  • 1,160
  • 7
  • 8