使用RoboVM绑定:https://github.com/BlueRiverInteractive/robovm-ios-bindings 更具体地说是Google Play游戏服务绑定。
我似乎无法编译绑定。得到此错误:
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)>
现在你可以说绑定本身有错误,但我认为情况并非如此,因为接下来会发生什么:
为什么会这样?怎么可能修好?
使用最新的GPGC绑定和最新的RoboVM nightlies(2014.01.05)。
谢谢。
编辑:绑定的作者解决了这个问题(截至2014.01.07)。
答案 0 :(得分:3)
最近RoboVM中块的编组已经发生了变化。这些绑定的作者必须相应地更新它们。以下是一个示例(来自UIApplication
),演示如何在实例方法中封送VoidBlock
:
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); }
}
以下是静态方法的示例(在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));
}
答案 1 :(得分:2)
BlueRiver绑定已经更新,包括这些更改 - 除了在应用内购买中使用的UIApplication中的几个回调。您可能只需要提取最新版本。