Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

IAP Badger not working with sandbox test account
Started by hasen6 Apr 22 2018 11:50 PM

20 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

I have IAP badger working in the simulator and on a device in debug mode absolutely no problems, I can make purchases coins get added etc. It's a consumable product to buy coins. But on a real device with debug set to false and a sandbox account it's not working.

 

The sandbox accounts are added into itunes connect and verified.

 

To make a purchase I first log out of my apple ID. Then I try to make a purchase and it says contacting apple store, then it asks if I want to use an existing account or create a new one. So I choose use existing, insert my sandbox ID and password and then after a little wait it shows a native alert failed purchase message.

 

Then if I click to purchase again it fails again.

 

I've double checked and all the product name IDs are exactly as they are in the itunes connect store. I'm guessing if they were incorrect then there should be a message from Apple to say so. It's weird Apple gives nothing back at all.

 

It's my understanding that the next step would be it would ask me to confirm the purchase or not but it doesn't get to that.



[TOPIC: post.html]
#2

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

No one knows? Can anyone at least confirm that they have no problems with Apple sandbox test accounts with IAP badger?



[TOPIC: post.html]
#3

basiliogerman

[GLOBAL: userInfoPane.html]
basiliogerman
  • Contributor

  • 100 posts
  • Corona SDK

We are having the same problem with our own store module. Test purchases come up with the purchase successful native alert but the transaction listener state says "failed" It has been a week that we have this issue, and we changed no code to trigger this behavior.

 

We are currently breaking our heads with this problem but have no fix, it would seem it's on Corona's side of things



[TOPIC: post.html]
#4

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

We are having the same problem with our own store module. Test purchases come up with the purchase successful native alert but the transaction listener state says "failed" It has been a week that we have this issue, and we changed no code to trigger this behavior.

 

We are currently breaking our heads with this problem but have no fix, it would seem it's on Corona's side of things

Is that specifically Apple and the tests are with sandbox testers?



[TOPIC: post.html]
#5

happymongoose

[GLOBAL: userInfoPane.html]
happymongoose
  • Contributor

  • 333 posts
  • Corona SDK

Have you tried using different build versions to check it isn't a bug on Corona's side introduced at some point (maybe try the latest build, and one from 3 months ago)?

 

Also, try setting verboseDebugOutput to true in your init function, and post the (relevant) output from the device log in XCode - it may reveal something useful.

 

Simon



[TOPIC: post.html]
#6

basiliogerman

[GLOBAL: userInfoPane.html]
basiliogerman
  • Contributor

  • 100 posts
  • Corona SDK

@hasen6 yes, Apple and sandbox testers. We are working with subscriptions.



[TOPIC: post.html]
#7

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 23,752 posts
  • Corona Staff

We have not made any changes to in app purchases in a long time. I doubt this is a "Corona" problem. Testing IAP's are notoriously difficult and it's not uncommon for Apple to have sandbox server issues.

 

Without seeing any messages from the device's console log it's going to be hard to draw any assumptions.

 

Rob



[TOPIC: post.html]
#8

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

We have not made any changes to in app purchases in a long time. I doubt this is a "Corona" problem. Testing IAP's are notoriously difficult and it's not uncommon for Apple to have sandbox server issues.

 

Without seeing any messages from the device's console log it's going to be hard to draw any assumptions.

 

Rob

There's no log with a real device since Corona opens it directly on the device and bypasses opening Xcode. Here is the log from a purchase on the simulator though:

Apr 28 12:38:05 SimondeiMac-2 solitaire 0.826[5961]: [aqme] 255: AQDefaultDevice (173): skipping input stream 0 0 0x0
Apr 28 12:38:14 --- last message repeated 4 times ---
Apr 28 12:38:14 SimondeiMac-2 com.apple.CoreSimulator.SimDevice.223BDA88-7793-49C5-950E-113BA141C600.launchd_sim[5882] (com.apple.imfoundation.IMRemoteURLConnectionAgent): Unknown key for integer: _DirtyJetsamMemoryLimit
Apr 28 12:38:14 SimondeiMac-2 com.apple.CallKit.CallDirectory[6033]: objc[6033]: Class AWDCXCallDirectoryChanged is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libAWDSupportFramework.dylib (0x1085a3d50) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/CallKit.framework/XPCServices/com.apple.CallKit.CallDirectory.xpc/com.apple.CallKit.CallDirectory (0x10741cb70). One of the two will be used. Which one is undefined.
Apr 28 12:38:14 SimondeiMac-2 logd[5893]: metadata shared cached uuid is null (using logd's shared cache info) com.apple.CallK (6033)
Apr 28 12:38:14 SimondeiMac-2 logd[5893]: Failed to harvest strings for pathless uuid '00000000-0000-0000-0000-000000000000'
Apr 28 12:38:14 SimondeiMac-2 com.apple.CallKit.CallDirectory[6033]: [Default] Error performing migrations: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “CallDirectory” in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/CallDirectory, NSUnderlyingError=0x7fb638f01060 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
Apr 28 12:38:14 SimondeiMac-2 com.apple.CallKit.CallDirectory[6033]: [Default] Error migrating store: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “CallDirectory” in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/CallDirectory, NSUnderlyingError=0x7fb638f01060 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
Apr 28 12:38:14 SimondeiMac-2 com.apple.CoreSimulator.SimDevice.223BDA88-7793-49C5-950E-113BA141C600.launchd_sim[5882] (com.apple.imfoundation.IMRemoteURLConnectionAgent): Unknown key for integer: _DirtyJetsamMemoryLimit
Apr 28 12:38:14 SimondeiMac-2 com.apple.CallKit.CallDirectory[6033]: [Default] Unable to initialize CXCallDirectoryStore for reading and writing: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “CallDirectory” in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/CallDirectory, NSUnderlyingError=0x7fb638c083b0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
Apr 28 12:38:14 SimondeiMac-2 callservicesd[5944]: [Default] Error synchronizing call directory extensions: Error Domain=com.apple.CallKit.error.calldirectorymanager Code=0 "(null)"
Apr 28 12:38:15 SimondeiMac-2 solitaire 0.826[5961]: [aqme] 255: AQDefaultDevice (173): skipping input stream 0 0 0x0
Apr 28 12:38:20 --- last message repeated 2 times ---
Apr 28 12:38:20 SimondeiMac-2 itunesstored[5963]: NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache/Cache.db.  Error=14. Cause=unable to open database file
Apr 28 12:38:20 SimondeiMac-2 itunesstored[5963]: CacheRead: unable to open cache files in /var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache
Apr 28 12:38:20 SimondeiMac-2 itunesstored[5963]: Failed to obtain sandbox extension for path=/var/mobile/Library/Caches/sharedCaches/com.apple.iTunesStore.NSURLCache. Errno:2
Apr 28 12:38:21 SimondeiMac-2 solitaire 0.826[5961]: [aqme] 255: AQDefaultDevice (173): skipping input stream 0 0 0x0


[TOPIC: post.html]
#9

happymongoose

[GLOBAL: userInfoPane.html]
happymongoose
  • Contributor

  • 333 posts
  • Corona SDK

Hi again,

 

The logs above shows the app has issues accessing cache files... but to be honest, I don't have the low-level experience of working with iOS to know what that means!  :)

 

(Though presumably, 'failed to obtain sandbox extension for iTunes Store' indicates that the app isn't able to access sandbox store functionality for some reason.  As Rob said, maybe an issue with iTunes servers.)

 

So this looks like something at a lower level than IAP Badger.  In terms of debugging any further IAP error messages, there may be some mileage in:

  • setting verboseDebugOutput to true
  • doing a standalone build (choose the 'do nothing' or 'show in finder' on the build dialog); do not create a live build.
  • manually copying your app onto the device using XCode
  • then running the app and checking the logs on XCode for additional error messages.

 

Simon


Edited by happymongoose, 28 April 2018 - 01:11 AM.


[TOPIC: post.html]
#10

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

Hi again,

 

The logs above shows the app has issues accessing cache files... but to be honest, I don't have the low-level experience of working with iOS to know what that means!  :)

 

(Though presumably, 'failed to obtain sandbox extension for iTunes Store' indicates that the app isn't able to access sandbox store functionality for some reason.  As Rob said, maybe an issue with iTunes servers.)

 

So this looks like something at a lower level than IAP Badger.  In terms of debugging any further IAP error messages, there may be some mileage in:

  • setting verboseDebugOutput to true
  • doing a standalone build (choose the 'do nothing' or 'show in finder' on the build dialog); do not create a live build.
  • manually copying your app onto the device using XCode
  • then running the app and checking the logs on XCode for additional error messages.

 

Simon

 

If you don't know then I certainly don't. And what with the other guy here having the same problem as well this seems a bit tough to fix. Up until now no one has confirmed that sandbox testing with Apple is currently working with IAP badger, can you confirm you've tested that and it works no problem (hopefully recently) ?

 

The problem is there's no log with Corona when opening on a device since XCode doesn't open.



[TOPIC: post.html]
#11

happymongoose

[GLOBAL: userInfoPane.html]
happymongoose
  • Contributor

  • 333 posts
  • Corona SDK

I haven't checked it recently, but IAP Badger was tested with sandbox users and it does/did work.  My last proper test with the sandbox was maybe 9 months to a year ago.

 

However, IAP Badger is just a wrapper class for the standard Corona store libraries.

 

So the key question here is: is the Corona iOS Apple IAP library working with sandbox users?

 

If Corona's standard libraries are working, IAP Badger will work (so this isn't an IAP Badger specific question).

 

 

Simon



[TOPIC: post.html]
#12

happymongoose

[GLOBAL: userInfoPane.html]
happymongoose
  • Contributor

  • 333 posts
  • Corona SDK

P.S. When you say Corona doesn't open XCode, you'll need to:

  • connect your device to your computer via USB
  • open XCode manually (through Launchpad etc.) like you would launch any other program on a Mac
  • go into the devices browser tool in XCode
  • run the app on your device
  • check the app log in the device browser on XCode

There may be some really useful data there coming back from Apple's servers.  Some of this will may get passed back to Corona / IAP Badger etc, but printed out in the device log.



[TOPIC: post.html]
#13

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

I haven't checked it recently, but IAP Badger was tested with sandbox users and it does/did work.  My last proper test with the sandbox was maybe 9 months to a year ago.

 

However, IAP Badger is just a wrapper class for the standard Corona store libraries.

 

So the key question here is: is the Corona iOS Apple IAP library working with sandbox users?

 

If Corona's standard libraries are working, IAP Badger will work (so this isn't an IAP Badger specific question).

 

 

Simon

Yes I was suggesting it was perhaps a problem with Corona, it was the Corona support that directed me to your thread. I guess someone else will be able to respond here and confirm whether there is a problem with the Corona IAP library.

 

In the meantime I'll try your suggestions on my device and feed back any error messages. Although I suspect they may be the same error messages as the simulator log gave.



[TOPIC: post.html]
#14

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

P.S. When you say Corona doesn't open XCode, you'll need to:

  • connect your device to your computer via USB
  • open XCode manually (through Launchpad etc.) like you would launch any other program on a Mac
  • go into the devices browser tool in XCode
  • run the app on your device
  • check the app log in the device browser on XCode

There may be some really useful data there coming back from Apple's servers.  Some of this will may get passed back to Corona / IAP Badger etc, but printed out in the device log.

Since Corona doesn't go through XCode I'm not quite sure how it works with the bundle ID. When I open in the xcode simulator I had to use a distribution provisioning profile that I created with the specific bundle ID. But when opening on a device I can't use a distribution provisioning profile, I have to use a developer provisioning profile. So I normally use a generic AD Hoc developer profile for any apps but I'm wondering if that is causing the problem with IAP?

 

Since if I do it that way I'm guessing the bundle ID won't be correct and then the purchases won't work. Can you confirm how I should open it on a device, with which type of profile?



[TOPIC: post.html]
#15

happymongoose

[GLOBAL: userInfoPane.html]
happymongoose
  • Contributor

  • 333 posts
  • Corona SDK

Okay, so I think that's your problem.  You can't use a generic ad hoc developer profile for IAP - you'll need to create an developer provisioning profile for that specific app.

 

So, there are a couple of things to be aware of that may help:

  • When you build your app, Corona talks to XCode in the background to create your app binary.  So, even though you don't see it being opened, XCode is an essential part of the process - one, thankfully, that Corona deals with on our behalf.
  • Once you've created your developer provisioning profile for your app, you'll need to download it and install it on your computer.  (You generate your provisioning profile through Apple developer rather than iTunes Connect.)
  • To view the device logs on your app, you open XCode and go to Window->Devices and Simulators.  As long as your device is plugged in, you'll be able to look on the actual device itself and check out the logs.  You do all of this manually, outside of Corona.
  • One last point - you talk about going into the XCode simulator: you can't test IAP using any of the simulated devices on XCode - you have to test iOS IAPs using a real device.

 

Going through all this in detail is a bit beyond the scope of a forum post, so my advice would be to carefully work through the advice on the following pages:

 

Unfortunately, with IAP, everything has to be set up absolutely perfectly both on your device and at the server end - and that makes resolving errors painful.



[TOPIC: post.html]
#16

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 23,752 posts
  • Corona Staff

Thanks @happymongoose for helping with this thread. You're spot on. You have to build your app using a provisioning profile that matches what's used in iTunes Connect. You need to either use a developer profile to test locally, or you can use a distribution for store profile and use TestFlight to install your app and test that way.

 

Rob



[TOPIC: post.html]
#17

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

Okay, so I think that's your problem.  You can't use a generic ad hoc developer profile for IAP - you'll need to create an developer provisioning profile for that specific app.

 

Ok I suspected that might be it since I noticed that's the only way Corona can set the bundle ID correctly. That's really annoying though because I went through the Ray Wenderlich tutorial for Apple In app purchases and he doesn't mention needing a specific developer ID for the app at all. Also I developed apps in the past with React Native and I never needed any specific app provisioning developer profiles, only distribution ones...One ad hoc developer was fine for everything so that's why I didn't know I would need it here...that and the fact the tutorial didn't mention it either!

 

So no wonder I couldn't find that. Is it only needed for Corona or something? Not sure why other tutorials don't mention the need for that.

 

So, there are a couple of things to be aware of that may help:

  • When you build your app, Corona talks to XCode in the background to create your app binary.  So, even though you don't see it being opened, XCode is an essential part of the process - one, thankfully, that Corona deals with on our behalf.
  • Once you've created your developer provisioning profile for your app, you'll need to download it and install it on your computer.  (You generate your provisioning profile through Apple developer rather than iTunes Connect.)
  • To view the device logs on your app, you open XCode and go to Window->Devices and Simulators.  As long as your device is plugged in, you'll be able to look on the actual device itself and check out the logs.  You do all of this manually, outside of Corona.
  • One last point - you talk about going into the XCode simulator: you can't test IAP using any of the simulated devices on XCode - you have to test iOS IAPs using a real device.

Ok you didn't mention that until now so I thought it was alright to test in the simulator. I tested on the device first and it didn't work so I was just checking other options since I was at my wit's end. I did see online that some people could manage to test it on the simulator but it seems perhaps that was only with certain versions of Xcode.

 

Anyway that was the problem and it does work now although I almost thought it still didn't. If the store country is wrong it says it's wrong, switches the store and then I get a null response. I had to log out and try the purchase again after the store country had changed to get a successful purchase. Hopefully this problem only happens with the sandbox.

 

Anyway you were right, it's certainly a pain and tutorials don't seem to help lol. Thanks for your help.



[TOPIC: post.html]
#18

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

Thanks @happymongoose for helping with this thread. You're spot on. You have to build your app using a provisioning profile that matches what's used in iTunes Connect. You need to either use a developer profile to test locally, or you can use a distribution for store profile and use TestFlight to install your app and test that way.

 

Rob

It seems you only need it for IAP. I developed many apps in the past with React Native and only ever needed a single Ad Hoc developer provisioning profile to test any of my apps on a device or in the simulator. I've never used testflight. Granted I never used IAP thought but the apps can be made no problem. In fact I can test my apps on a device with the Ad Hoc developer profile even with Corona...it's just the IAP won't work like that it seems. Annoying.



[TOPIC: post.html]
#19

happymongoose

[GLOBAL: userInfoPane.html]
happymongoose
  • Contributor

  • 333 posts
  • Corona SDK

I have thought about putting a tutorial of my own for this (maybe a set of videos, saying do this, now this, now this), but things change so often, I'd spend my life checking the information was correct and updating it.



[TOPIC: post.html]
#20

happymongoose

[GLOBAL: userInfoPane.html]
happymongoose
  • Contributor

  • 333 posts
  • Corona SDK

But have added some notes about your difficulties here:

 

http://happymongoosegames.co.uk/iapbadger.php

 

to try to help other users avoid these in the future.



[TOPIC: post.html]
#21

hasen6

[GLOBAL: userInfoPane.html]
hasen6
  • Contributor

  • 151 posts
  • Corona SDK

But have added some notes about your difficulties here:

 

http://happymongoosegames.co.uk/iapbadger.php

 

to try to help other users avoid these in the future.

Yeah that looks great, thanks for your efforts. Not to mention thanks for making your plugin which I haven't said yet. It enabled me to set up IAP relatively easily - well apart from this issue anyway.




[topic_controls]
[/topic_controls]