libgdx / gdx-pay

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

gdx-pay for iOS works every second time #132

Closed aberkowski closed 5 years ago

aberkowski commented 7 years ago

I have implemented gdx-pay for iOS and it works fine for the first time, but if I try to purchase item for the second time I get an error:

Transaction failed: Error Domain=SKErrorDomain Code=0 "Cannot connect to Itunes Store"

I receive this error every second time and every second time it works fine... I'm using: gdxVersion = '1.9.4', gdxPay = "0.10.3", roboVMVersion = '2.2.0'.

keesvandieren commented 7 years ago

Hi, maybe you can create a little reproduction project? I have an app with a non-consumable purchase, that one works fine. With Robovm 2.2.1-SNAPSHOT and Libgdx 1.9.4.

aberkowski commented 7 years ago

How many non-consumable products do you have? My first purchase also works fine. Problem is when I want to buy another product or the same consumable product for the second time. So first purchase is ok, second is not ok, third is ok and fourth is not ok and so on....

keesvandieren commented 7 years ago

Aha, I have only one. If you create a little reproduction project, I or @noblemaster can have a look at it.

aberkowski commented 7 years ago

I didin't mention that my game is for Android and iOS devices. Everything works fine on Android Google Play store. I have one code for both platforms so I think it's not a problem of my code (one difference is that I'm adding one store parameters for each project: AppStore for iOS project and Google Play store for Android project - even the names of products are the same). I think the problem is with gdx-pay implementation for iOS. Maybe it would be easier if you could add one more product to your iOS app? I don't know if an app products created by me will be visible for you if I will create a test iOS project. What with provisioning profiles then - will you have to use my provisioning profile?

keesvandieren commented 7 years ago

Hi,

You can clone this project as basis to have a working example with gdx-pay: https://github.com/jsvitek/gdx_pay_issue118 (this was used to reproduce #118)

I did not make gdx-pay iOS, so its quite new for me as well. And I am quite busy atm, so if I have a project that reproduces it with simple steps, it will save me time.

You do not have to share provisioning profiles. Just the Product ID and Product Type is enough.

aberkowski commented 7 years ago

Ok, I've created a new project and tested it on iOS - it works the same - every other purchase works. Here is the link: https://github.com/Berobasket/gdx-pay-issue . I will be very pleased if you can take a look at it. Regards

aberkowski commented 7 years ago

Any news? Did you have some time to take a look at it? I will be very grateful..

keesvandieren commented 7 years ago

Sorry, I have some high-prio work for a customer to do, hope to be able to look next week

keesvandieren commented 7 years ago

Hi,

I have tried to reproduce it, but on my device it is working fine.

I have created a consumable product, and am using a Sandbox test user (like described here: https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SettingUpUserAccounts.html#//apple_ref/doc/uid/TP40011225-CH25-SW10 )

I have bought it 8 times in a row without any problem.

Are you using a sandbox user as well? Which iOS version are you using? My tablet has 9.3.2 How do you launch the app? I am using ./gradlew clean launchIOSDevice from Android Studio. In XCode there is a console as well, which sometimes shows additional output. Do you see any relevant information there?

aberkowski commented 7 years ago

Yes, I'm using Sandbox test user too. I'm able to buy product for the first time so I think that it's not a problem of Sandbox user. My iPhone has iOS 10.1.1. I launch app through eclipse - right click on the iOS project, select "Run As->iOS Device App". I've tried to run app from a command line. Here is the output:

./gradlew clean launchIOSDevice --stacktrace Starting a new Gradle Daemon for this build (subsequent builds will be faster). Configuration on demand is an incubating feature. :android:clean UP-TO-DATE :core:clean :desktop:clean UP-TO-DATE :ios:clean :core:compileJava warning: [options] bootstrap class path not set in conjunction with -source 1.6 1 warning :core:processResources UP-TO-DATE :core:classes :core:jar :ios:compileJava warning: [options] bootstrap class path not set in conjunction with -source 1.7 Note: /Users/bero/Documents/workspace/gdx-pay-issue/ios/src/pl/com/berobasket/gdxpayissue/IOSActionResolver.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 warning :ios:processResources UP-TO-DATE :ios:classes :ios:jar :ios:assemble :ios:compileTestJava UP-TO-DATE :ios:processTestResources UP-TO-DATE :ios:testClasses UP-TO-DATE :ios:test UP-TO-DATE :ios:check UP-TO-DATE :ios:build :ios:launchIOSDevice RoboVM has detected that you are running on a slow HDD. Please consider mounting a RAM disk. To create a 2GB RAM disk, run this in your terminal: SIZE=2048 ; diskutil erasevolume HFS+ 'RoboVM RAM Disk' hdiutil attach -nomount ram://$((SIZE * 2048)) See http://docs.robovm.com/ for more info Classpath entry /Users/bero/Documents/workspace/gdx-pay-issue/ios/build/resources/main does not exist [GdxPay/AppleIOS] Installing purchase observer... [GdxPay/AppleIOS] Requesting products... [GdxPay/AppleIOS] Products successfully received! [GdxPay/AppleIOS] Purchase observer successfully installed! [GdxPay/AppleIOS] There are 0 unfinished transactions. Try to finish... [GdxPay/AppleIOS] Purchasing product pl.com.berobasket.gdxpayissue.consumable1 ... [GdxPay/AppleIOS] Transaction was completed: 1000000257803888 [GdxPay/AppleIOS] Purchasing product pl.com.berobasket.gdxpayissue.consumable1 ... [GdxPay/AppleIOS] Transaction failed: Error Domain=SKErrorDomain Code=0 "Nie można połączyć się z iTunes Store" UserInfo={NSLocalizedDescription=Nie można połączyć się z iTunes Store} [GdxPay/AppleIOS] Purchasing product pl.com.berobasket.gdxpayissue.consumable1 ... [GdxPay/AppleIOS] Transaction was completed: 1000000257803919

Result is the same - I'm able to buy item only for the first and third time, second is wrong. This error when transaction is failed means "Cannot connect to iTunes store". Do you have some ideas?

vgjokaj commented 7 years ago

Hi,

I'm having the same issue, I get this error every second time that I want to purchase a product. Did anyone come up with some kind of solution?

aberkowski commented 7 years ago

Good to know that I'm not alone ;) @vgjokaj could you write what version of iOS do you have?

vgjokaj commented 7 years ago

9.3.1 It's strange, because in android it works perfectly.

aberkowski commented 7 years ago

@keesvandieren or @noblemaster did you find any solution or workaround for this problem?

noblemaster commented 7 years ago

No sorry. I am using the same code & it appears to work just fine for me. I'll look into it when I find some time.

aberkowski commented 7 years ago

It has to be some difference if it works for you and @keesvandieren and doesn't work for me and @vgjokaj . I'm using: gdxVersion = '1.9.4', roboVMVersion = '2.2.0', gdxPay = "0.10.3"; I'm using Eclipse Neon.1 with RoboVM for Eclipse 2.2.1 on Mac OS Sierra 10.12.1 and XCode 8.1. Do you all have the same configuration?

aberkowski commented 7 years ago

@vgjokaj could you write what configuration do you have?

aberkowski commented 7 years ago

Ok, I've changed IDE from Eclipse to Android Studio and everything works fine.. My only change was to upgrade gradle build tools version from 0.9+ to 2.1.0 version. I had also Google Play Services as library project in my Elicpse workspace. Now I have everything in gradle and it works great. Android Studio is much simpler and user friendly btw :) @vgjokaj I encourage you to migrate from Eclipse to Android Studio. You have nothing to lose ;)

keesvandieren commented 5 years ago

Close old issue