我正在尝试为Android和iOS设置gdx-pay以允许我在我的游戏中提供应用内购买。我已经完成了Android代码的设置部分,但我遇到了iOS问题。
我收到了应用内购买请求和对话框,说明"确认您的应用内购买"弹出。但是,我关闭了应用程序而未点击"取消"或"购买"现在我遇到了问题。每当我运行游戏时,我都会收到此错误:
[GdxPay/AppleIOS] Products successfully received!
[GdxPay/AppleIOS] Purchase observer successfully installed!
[GdxPay/AppleIOS] There are 1 unfinished transactions. Try to finish...
[GdxPay/AppleIOS] Transaction failed: Error Domain=SKErrorDomain Code=0
"Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}
com.badlogic.gdx.utils.GdxRuntimeException: java.lang.RuntimeException:
Transaction failed: Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}
at com.tea.game.ShapeGame$1.handlePurchaseError(ShapeGame.java:78)
at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple$AppleTransactionObserver.updatedTransactions(PurchaseManageriOSApple.java:411)
at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple$AppleProductsDelegate.didReceiveResponse(PurchaseManageriOSApple.java:299)
at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple$AppleProductsDelegate.$cb$productsRequest$didReceiveResponse$(PurchaseManageriOSApple.java)
at org.robovm.apple.uikit.UIApplication.main(Native Method)
at org.robovm.apple.uikit.UIApplication.main(UIApplication.java:395)
at com.tea.game.IOSLauncher.main(IOSLauncher.java:54)
Caused by: java.lang.RuntimeException:
Transaction failed: Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}
... 6 more
此错误表示问题为"无法连接到iTunes Store"但我相信那只是因为我在模拟器上运行它。当我在iPhone上运行它时,应用程序会在同一时刻崩溃。
我认为它正在崩溃,因为它正在尝试完成交易但无法完成("有1个未完成的交易。尝试完成......")
如果有人能提供解决方案/方法来防止再次发生这种情况,那将非常感激。