libgdx / gdx-pay

A libGDX cross-platform API for InApp purchasing.
Apache License 2.0
225 stars 82 forks source link

iOS NullPointerException #39

Closed mickmuzac closed 9 years ago

mickmuzac commented 9 years ago

I'm currently running RoboVM version 1.1.0 and gdx-pay version 0.4.0.

Please let me know if you'd like more information.

2015-05-18 18:48:29.771 IOSLauncher[431:40159] [debug] IOSApplication: iOS version: 8.3
2015-05-18 18:48:29.773 IOSLauncher[431:40159] [debug] IOSApplication: Running in 32-bit mode
2015-05-18 18:48:29.786 IOSLauncher[431:40159] [debug] IOSApplication: scale: 2.0
2015-05-18 18:48:29.872 IOSLauncher[431:40159] [debug] IOSApplication: Unscaled View: LandscapeRight 568x320
2015-05-18 18:48:29.873 IOSLauncher[431:40159] [debug] IOSApplication: View: LandscapeRight 1136x640
2015-05-18 18:48:29.873 IOSLauncher[431:40159] [debug] IOSGraphics: 1136.0x640.0, 2.0
2015-05-18 18:48:30.197 IOSLauncher[431:40159] [debug] IOSGraphics: Display: ppi=326, density=2.0375
2015-05-18 18:48:30.607 IOSLauncher[431:40159] [debug] IOSApplication: created
2015-05-18 18:48:30.919 IOSLauncher[431:40159] [debug] didBecomeActive: Returning from: fb
2015-05-18 18:48:30.920 IOSLauncher[431:40159] [debug] IOSApplication: resumed
Loading class 'java.util.logging.ConsoleHandler' failed
java.lang.ClassNotFoundException: java.util.logging.ConsoleHandler
2015-05-18 18:48:32.988 IOSLauncher[431:40159] [info] IAP: IAP: gdx-pay successfully instantiated.
[GdxPay/AppleIOS] Installing purchase observer...
[GdxPay/AppleIOS] Requesting products...
[GdxPay/AppleIOS] Products successfully received!
[GdxPay/AppleIOS] Purchase observer successfully installed!
java.lang.NullPointerException
    at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple$AppleTransactionObserver.updatedTransactions(PurchaseManageriOSApple.java)
    at org.robovm.apple.storekit.SKPaymentTransactionObserver$ObjCProxy.$cb$paymentQueue$updatedTransactions$(Unknown Source)
    at org.robovm.apple.uikit.UIApplication.main(Native Method)
    at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
    at com.company.game.IOSLauncher.main(IOSLauncher.java)
mickmuzac commented 9 years ago

The error object here is null:

https://github.com/libgdx/gdx-pay/blob/master/gdx-pay-iosrobovm-apple/src/com/badlogic/gdx/pay/ios/apple/PurchaseManageriOSApple.java#L364

noblemaster commented 9 years ago

That's odd that the error object is "null". I uploaded a new SNAPSHOT-release (0.5.0-SNAPSHOT) which check if the error object is null, i.e. it shouldn't crash anymore if that is the case.

In any case, there might be something more to it than just the error object being null? Let me know how it goes.

mickmuzac commented 9 years ago

So, upon doing a little more testing (and working around), this issue may be more of an edge case than I originally thought. I can only reproduce it when I am testing an unreviewed app on my device while logged in using an Apple ID that is not designated as a Sandbox Tester in iTunes Connect.

If I am not logged in, this doesn't happen. If I am logged in as a Sandbox Tester, this doesn't happen. Your change does fix it for me and is probably worth keeping. I haven't come across any other NPE's.

Nonetheless, this issue is now resolved for me, so I'll go ahead and close this.