RoboVM绑定编译问题

4
使用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)>

现在你可以说绑定本身存在错误,但我认为不是这种情况,因为以下是发生的事情:
  1. 如果您直接运行GPGC项目(通过运行示例应用程序),它将正确编译并在模拟器上运行。
  2. 如果您尝试编译具有GPGC项目引用的整个libGDX游戏,则会抛出此错误。
  3. 如果您更改GPGLeaderboard文件(包含错误的文件)并尝试直接运行GPGC项目,则也会出现此错误。如果第二次运行它,它会神奇地消失。
这是为什么?如何解决?
使用最新的GPGC绑定和最新的RoboVM夜间版本(2014.01.05)。
谢谢。
编辑:绑定的作者解决了这个问题(截至2014年1月7日)。
2个回答

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));
}

据我所知,这些绑定已经更新到最新的RoboVM版本。也许你没有理解我的初始问题,如果直接编译,这些绑定可以编译通过,但是如果从另一个项目中引用并编译,则会出现错误(请参见我原始问题中的3个要点)。感谢您的回复。 - Justas Sakalauskas
1
好的,抱歉我联系了绑定库的作者,他成功地解决了这个问题。;) - Justas Sakalauskas

2

BlueRiver绑定已经更新以包含这些更改-除了在应用内购买中使用的UIApplication中的一些回调。您可能只需要拉取最新版本。


好的,是的,我知道这些错误已经被修复了,并且我在我的问题中提到我有最新的绑定。只是为了确保,我再次下载了它们(2014.01.07)。问题仍然存在。还请看一下我在问题中提到的3个要点,这就是让它变得有趣的地方。 - Justas Sakalauskas
看起来 GPGLeaderboard 最近刚刚修复了,可能是在你更新后几个小时内。 - ericn
关于你提到的不一致的构建错误,我也遇到过,但通常在构建过程中的某个时候会抛出错误。 - ericn

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接