在 iOS 尝试购买时 Gdx-pay 崩溃

Gdx-pay crashes when attempting a purchase on iOS

我正在尝试使用 gdx-pay 将 IAP 添加到我的应用程序。这在 Android 上运行良好,但我的应用程序在尝试购买测试时崩溃。我已经在 iTunes Connect 上成功设置了沙盒,看来采购经理至少连接成功了。然而,我没有在应用程序崩溃时得到任何堆栈跟踪,所以我真的不知道如何开始调试它。我在尽可能多的地方添加了日志,受限于一些只读文件。这是我尝试购买 IAP 时的流程:

[GdxPay/AppleIOS] Products successfully received!
[GdxPay/AppleIOS] Purchase observer successfully installed!
2017-02-06 18:27:01.475036 Snowfall[478:80137] [info] PAYMENTINFO: Handling Install
[GdxPay/AppleIOS] There are 0 unfinished transactions. Try to finish...
[GdxPay/AppleIOS] Products successfully received!
[GdxPay/AppleIOS] Purchase observer successfully installed!
2017-02-06 18:27:01.719032 Snowfall[478:80137] [info] PAYMENTINFO: Handling Install
[GdxPay/AppleIOS] There are 0 unfinished transactions. Try to finish...
2017-02-06 18:28:02.054620 Snowfall[478:80137] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2017-02-06 18:28:02.054790 Snowfall[478:80137] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
[GdxPay/AppleIOS] Purchasing product char2 ...

Process finished with exit code -1

不太清楚为什么 'process finishes' 应用程序关闭并且没有堆栈跟踪。我在 Mac OS 上使用 IntelliJ。一个简单的入门问题是如何在 IntelliJ 上启用更好的堆栈跟踪?稍微复杂一点,这是怎么回事?

LibGDX 版本 1.9.5

roboVM 版本 2.3.0

gdx-pay 版本 0.10.3

这是相关的 iOS 代码。所有其他 gdx-pay 代码主要是从 Github 复制粘贴的,并且可以与 Android.

一起正常工作

启动:

public class Snowfall extends IOSApplication.Delegate {
JumpV6 game;
@Override
protected IOSApplication createApplication() {
    IOSApplicationConfiguration config = new IOSApplicationConfiguration();
    config.orientationLandscape = true;
    config.orientationPortrait = false;
    game = new JumpV6();
    game.setAppStore(APPSTORE_APPLE);
    return new IOSApplication(game, config);
}

@Override
public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) {
    super.didFinishLaunching(application, launchOptions);
    game.setPlatformResolver(new IOSResolver(game));
    return true;
}


public static void main(String[] argv) {
    NSAutoreleasePool pool = new NSAutoreleasePool();
    UIApplication.main(argv, null, Snowfall.class);
    pool.close();
}}

解析器:

public class IOSResolver extends PlatformResolver {

String appleKey = "......"; //omitted

public IOSResolver(JumpV6 myGame) {
    super();

    PurchaseManagerConfig config = myGame.purchaseManagerConfig;
    config.addStoreParam(PurchaseManagerConfig.STORE_NAME_IOS_APPLE,appleKey);
    initializeIAP(null, myGame.purchaseObserver, config);
    installIAP();
}}

谢谢

经过一段时间的努力,我似乎​​只需要 post 在 Stack 上查看我做错了什么。 Resolver class 是 copy-pasted 来自某个地方的互联网,我意识到我从来没有真正经历过每一行在做什么。然后我认为 installIAP() 不需要在那里,所以我把它注释掉了。工作解析器:

public class IOSResolver extends PlatformResolver {
    String appleKey = "......"; //omitted
    public IOSResolver(JumpV6 myGame) {
        super();
        PurchaseManagerConfig config = myGame.purchaseManagerConfig;
        config.addStoreParam(PurchaseManagerConfig.STORE_NAME_IOS_APPLE,appleKey);
        initializeIAP(null, myGame.purchaseObserver, config);
        //installIAP();
    }
}