【问题标题】:Gdx-pay crashes when attempting a purchase on iOS尝试在 iOS 上购买时 Gdx-pay 崩溃
【发布时间】:2017-02-06 23:45:36
【问题描述】:

我正在尝试使用 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

不太清楚为什么“进程完成”,应用程序关闭并且没有堆栈跟踪。我在 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();
}}

谢谢

【问题讨论】:

    标签: ios intellij-idea libgdx robovm


    【解决方案1】:

    经过一段时间的处理,看来我需要做的就是在 Stack 上发帖,看看我做错了什么。 Resolver 类是从互联网某处复制粘贴的,我意识到我从未真正了解过每一行在做什么。然后我认为 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();
        }
    }
    

    【讨论】:

    • 我有这个确切的问题。你能详细说明initializeIAP()installIAP() 在你的情况下做了什么吗?在较新的 GdxPay sdks 中,我只能选择致电 PurchaseSystem.install(observer, config)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多