我正在尝试使用gdx-pay将IAP添加到我的应用中。这在Android上工作正常但我的应用程序在尝试购买测试时崩溃了。我已经在iTunes Connect上成功设置了Sandbox,看来购买经理至少成功连接。然而,我在应用程序崩溃时没有得到任何堆栈跟踪,所以我真的不知道如何开始调试它。我已经在尽可能多的地方添加了日志,受到一些只读文件的限制。这是我尝试购买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 version 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();
}}
谢谢
答案 0 :(得分:0)
经过一段时间的努力,看来我需要做的就是在Stack上发帖,看看我做错了什么。解析器类是从某个地方的互联网上复制粘贴的,我意识到我从未真正了解过每一行的内容。然后我认为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();
}
}