简体   繁体   English

RoboVM绑定编译问题

[英]RoboVM bindings compiling problems

Using RoboVM bindings: https://github.com/BlueRiverInteractive/robovm-ios-bindings more specifically Google Play Game Service bindings. 使用RoboVM绑定: https//github.com/BlueRiverInteractive/robovm-ios-bindings更具体地说是Google Play游戏服务绑定。

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. 如果直接运行GPGC项目(通过运行示例应用程序),它将正确编译并在模拟器上运行。
  2. If you try to compile your whole libGDX game that has GPGC project referenced it throws this error. 如果您尝试编译整个引用了GPGC项目的libGDX游戏,则会抛出此错误。
  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. 如果您更改GPGLeaderboard文件(包含错误的文件)并尝试直接运行GPGC项目,它也会抛出此错误。 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). 使用最新的GPGC绑定和最新的RoboVM nightlies(2014.01.05)。

Thank you. 谢谢。

EDIT: the author of the bindings fixed this issue (as of 2014.01.07). 编辑:绑定的作者解决了这个问题(截至2014.01.07)。

The marshaling of blocks have changed recently in RoboVM. 最近在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: 这是一个示例(来自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); }
}

And here's an example for a static method (in UIView ): 这是一个静态方法的例子(在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));
}

The BlueRiver bindings have already been updated to include these changes - except for a couple callbacks in the UIApplication used with in-app purchases. BlueRiver绑定已经更新,包括这些更改 - 除了在应用内购买中使用的UIApplication中的几个回调。 You'll probably just need to pull the latest version. 您可能只需要提取最新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM