Can you describe the issue better? Is it crashing or freezing after restore? When did you build?
When restore() is called the app freezes. I can just press Menu to get back to Home. Navigation stops. I’ve don some building the last couple of hours.
ok looking into it
It seems to be working for me, can i get some logs?
I just pushed update used array of tables instead of a new event for every item to restore so e.transaction.state == “restored”
Thanks. Now it works!
There is still an odd thing going on with the audio. In the app I have two scenes. One main menu scene and one video scene.
In the menu there are 4 buttons. When you click on a button it goes to the video scene and load/start an audiostream and a videofile (with no sound). One clip is free and the other needs to be unlocked.
Problem is this.
-
Click on button one with the free clip and watch the video (goes to videoscene)
-
Press Menu (returns to the menu scene and stops the audio and video)
-
Make the purchase and unlock the videos
-
Click on any button to start free or unlocked clip. The video starts but audio is muted.
If one kill the app and restart it everything works. If one make a restore (If unlock already purchased) everything works. If one make the purchase without playing the free clip first everything works. So I thought it may be something with playing both a video and an audiostream at the same time. But the problem only occurs after the purchase so maybe there is something in storeKit that mutes the audio? It feels like something is muting the audio “behind the scene”. Even if I reset the volume, stop the audio, dispose it, reload and rewind, reserve channels, remove video scene and reload scene nothing works. But as soon as I restart the app, it works again and it only happens after a purchase. It’s really odd.
Can you make a demo project demonstrating this issue? For the record, my plugin does not do anything with the audio.
Hi again.
I uploaded a new version yesterday but it’s still the same problem when purchasing. But now restore works. I first build the app an tested through Testfligt and everything worked. Both purchase and restore. Then I activated the same build for the store and now it’s for sale but you can’t make any purchase. But now you can restore a purchase.
When trying to do a purchase I get all alerts from Appstore as normal. “Please confirm you want to purchase…”, “You have already purchased…” etc.
The code is from your post:
----=======================================--- -- Configure IAP ----=======================================--- local store = require("plugin.storeKit") local json = require("json") store.init(function(e) print( "init") print( "------" ) print(json.encode(e) ) print( "------" ) if e.transaction.state == "purchased" then --native.showAlert("Success", "Thank you for the purchase", {"OK"}) removeLocking() elseif e.transaction.state == "restored" then --native.showAlert("Success", "Your product is restored!", {"OK"}) removeLocking() elseif e.transaction.state == "failed" then native.setActivityIndicator( false ) --native.showAlert("Failed", "Your purchase failed. Please, try again.", {"OK"}) waitForPurchase = false else native.setActivityIndicator( false ) waitForPurchase = false end end) --local Products = {"com.anscamobile.NewExampleInAppPurchase.NonConsumableTier1", "com.anscamobile.NewExampleInAppPurchase.ConsumableTier1"} --local thePurchaseProduct = "com.anscamobile.NewExampleInAppPurchase.ConsumableTier1" local Products = { "com.filmicart.deepocean.unlockvideos" } local ProductToPurchase = "com.filmicart.deepocean.unlockvideos" timer.performWithDelay( 1000, function ( ) store.loadProducts( Products, function ( e ) print( "loadProducts") print( "------" ) print(json.encode(e) ) print( "------" ) local p = e.products[1] if p ~= nil then print(p.title) print(p.localizedPrice) end end ) end)
Is there another status I need to fetch. I don’t know if Apple handles Testflights different from a released except that I’m using a Sandbox tester for Testflight and my real user for the released version.
The calling code:
native.setActivityIndicator( true ) store.purchase(ProductToPurchase)
Any idea?
I am working on a fix, I have to try to guess since I don’t have any Apple TV apps to test. That being said I think I know what the issue is. Working on a fix
Thanks. If you have space on your ATV you can download the app, if it helps you. It’s 620MB.
Can you post or email me the link I might take a lot at it
Pushed out update please try again in hour
Scott, there is still the same problem. Purchase never finish but restore works. Maybe there is a problem with transaction sin the que that are unfinished? Both me and me client have tested without sucess. When trying from Testflight (same build as the released) everything works. So only way to test right now is to release a new version. It looks like Apple completes the purchase and charge the user but StoreKit doesn’t seems to recieve e.transaction == “purchased”
Right now I will try to rebuild the app in Swift but I would be really nice to use your plugin and Corona instead.
Just curious does cancel work at all?
I will try the app link you sent when I get home see if I can find anything in the logs.
Good question. When you do a purcahse it “fails” after the last alert from Appstore. I don’t think I have tried to cancel a real purchase as I have been focus on doing a purchase.
On Testflight cancel work. When appstore ask if you want buy and you say no, it cancel the purchase.
I tried the link you send me but it does not seems to show up, can you give me the logs. I am still having to guess but am pushing out an update the should make sure are always in production mode.
If you can receive a cancel event that would be very helpful information, but still please just email me your logs of your app
Hi Scott, I’m trying this plugin in again with a new App and it seems to work but there is still something going on with the audio. I’m starting one video file and one audio file. Evrytime I make a purchase the audiofile is muted and I need to restart the app. Can’t reset the volume. If I include the audio in the videofile it works but then it doesn’t loop as a smooth as before. If I restart the app everything works as it should. Any idea?
Last time I rebuilt the app in Swift but I prefer to use Corona and your plugin if it works.