Question

Using RoboVM bindings: https://github.com/BlueRiverInteractive/robovm-ios-bindings more specifically Google Play Game Service bindings.

I can't seem to be able to compile the bindings. Getting this error:

An internal error occurred during: "Launching my-gdx-game-robovm".
No @Marshaler found for parameter 3 of @Bridge method 
<org.robovm.bindings.gpgs.GPGLeaderboard: void   
objc_loadScoresWithCompletionHandler(org.robovm.bindings.gpgs.GPGLeaderboard,org.robovm.objc.S elector,org.robovm.bindings.gpgs.GPGLeaderboardLoadScoresBlock)>

Now you could say that there is an error with the bindings themselves but I think that isn't the case because heres what happens:

  1. If you run GPGC project directly (by running the sample application) it compiles properly and runs on simulator.
  2. If you try to compile your whole libGDX game that has GPGC project referenced it throws this error.
  3. If you make changes to GPGLeaderboard file (the file containing the error) and try to run GPGC project directly it throws this error too. If you run it second time it magically disappears.

Why is this happening? How could it be fixed?

Using latest GPGC bindings and latest RoboVM nightlies (2014.01.05).

Thank you.

EDIT: the author of the bindings fixed this issue (as of 2014.01.07).

Was it helpful?

Solution

The marshaling of blocks have changed recently in RoboVM. The author of these bindings has to update them accordingly. Here's an example (from UIApplication) that shows how to marshal a VoidBlock in an instance method:

private static final Selector beginBackgroundTaskWithExpirationHandler$ = Selector.register("beginBackgroundTaskWithExpirationHandler:");
@Bridge private native static int objc_beginBackgroundTask(UIApplication __self__, Selector __cmd__, ObjCBlock handler);
@Bridge private native static int objc_beginBackgroundTaskSuper(ObjCSuper __super__, Selector __cmd__, ObjCBlock handler);
public int beginBackgroundTask(VoidBlock handler) {
    return beginBackgroundTask(VoidBlock.Marshaler.toObjCBlock(handler));
}
protected int beginBackgroundTask(ObjCBlock handler) {
    if (customClass) { return objc_beginBackgroundTaskSuper(getSuper(), beginBackgroundTaskWithExpirationHandler$, handler); } else { return objc_beginBackgroundTask(this, beginBackgroundTaskWithExpirationHandler$, handler); }
}

And here's an example for a static method (in UIView):

private static final Selector animateWithDuration$animations$ = Selector.register("animateWithDuration:animations:");
@Bridge private native static void objc_animate(ObjCClass __self__, Selector __cmd__, double duration, ObjCBlock animations);
public static void animate(double duration, VoidBlock animations) {
    objc_animate(objCClass, animateWithDuration$animations$, duration, VoidBlock.Marshaler.toObjCBlock(animations));
}

OTHER TIPS

The BlueRiver bindings have already been updated to include these changes - except for a couple callbacks in the UIApplication used with in-app purchases. You'll probably just need to pull the latest version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top