libgdx / gdx-pay

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

[iOS] NoSuchMethodError: org.robovm.apple.storekit.SKPayment.createFromProduct #34

Closed peterwilli closed 9 years ago

peterwilli commented 9 years ago

Hi,

Recently I tried testing my in app purchases on iOS and it doesnt work as expected. I updated to the latest LibGDX (1.5.5) and RoboVM (1.0.0)

I can recall it used to work (or atleast purchasing) and I am stuck on this error when I try to purchase a product:

java.lang.NoSuchMethodError: org.robovm.apple.storekit.SKPayment.createFromProduct(Lorg/robovm/apple/storekit/SKProduct;)Lorg/robovm/apple/storekit/SKPayment;
    at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple.purchase(PurchaseManageriOSApple.java)
    at com.badlogic.gdx.pay.PurchaseSystem.purchase(PurchaseSystem.java)
    at co.codebuffet.mazle.shop.ItemButton.didClick(ItemButton.java)
    at co.codebuffet.libraries.DarkeningImageScrollButton$1.touchUp(DarkeningImageScrollButton.java)
    at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java)
    at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java)
    at com.badlogic.gdx.InputMultiplexer.touchUp(InputMultiplexer.java)
    at com.badlogic.gdx.backends.iosrobovm.IOSInput.processEvents(IOSInput.java)
    at com.badlogic.gdx.backends.iosrobovm.IOSGraphics.draw(IOSGraphics.java)
    at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.draw(IOSGraphics.java)
    at org.robovm.apple.uikit.UIView.$cb$drawRect$(UIView.java)
    at org.robovm.apple.uikit.UIApplication.main(Native Method)
    at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
    at co.codebuffet.mazle.IOSLauncher.main(IOSLauncher.java)

I also removed my robovm cache prior to running (using rm -rf ~/.robovm/cache) and strangely enough, loading products seems to work fine:

[GdxPay/AppleIOS] Products successfully received!
[GdxPay/AppleIOS] Purchase observer successfully installed!

I'm struggling with this all day and still am :( It would be really nice if someone knows what's going on! Thanks in advance!

Update

It seems that RoboVM updated their function naming! See: http://docs.robovm.com/api/1.0.0/org/robovm/apple/storekit/SKPayment.html#createFromProduct-org.robovm.apple.storekit.SKProduct- It's called public static SKPayment create(SKProduct product) in 1.0.0

But let's take a beta of 1.0 (LibGDX 1.5.4 uses the snapshot build of robovm): http://docs.robovm.com/api/1.0.0-beta-03/org/robovm/apple/storekit/SKPayment.html#createFromProduct-org.robovm.apple.storekit.SKProduct- There it's called: public static SKPayment createFromProduct(SKProduct product)

Update 2 Testing fix now

peterwilli commented 9 years ago

I'm making a fork + pull request for this issue, as well as abillity to list product information as we need that and it's not there yet :last_quarter_moon_with_face:

noblemaster commented 9 years ago

Thanks for investigation! Please submit your pull request when you have it ready and I shall add it. I'll create a new release also. :-D

peterwilli commented 9 years ago

@noblemaster the first pull request has been made. I tested it on my end with my game and it works. See: https://github.com/libgdx/gdx-pay/pull/35

The part where you can fetch products I'll do later tonight or tomorrow.

noblemaster commented 9 years ago

Great! I integrated your pull request. Thanks for the hard work :-D

Please note, I created a new release also; use gdx-pay 0.4.0 (or 0.5.0-SNAPSHOT) now.

peterwilli commented 9 years ago

Thanks @noblemaster! I'll close this issue then.