Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

StoreKit not working on tvOS
Started by mfr Dec 16 2016 07:10 AM

82 replies to this topic
[TOPIC CONTROLS]
Page 1 of 4 1 2 3 »
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

I'm trying to release my first tvos app and try to use this plugin. When uploading to iTunes Connect it complains about App thinning problem.

 

I'm using below settings in build.settings. I also tried to add supported platform then it was possible to upload and pass the Testflight process but the app doesn't start, just a black screen. A runtime error. When I remove the plugin it works but then I can't use IAP. :)

 

I'm using the latest daily build.

["plugin.storeKit"] = {
                publisherId = "com.scottrules44",
                --supportedPlatforms = { tvos=true }
            },
local store = require("plugin.storeKit")
local json = require("json")

----=======================================---
-- Configure IAP
----=======================================---

store.init(function(e)
    print( "init") 
    print( "------" )
    print(json.prettify(e) )
    print( "------" )
    
    if e.transaction.state == "purchased" then
        native.showAlert("Success", "Thank you for the purchase", {"OK"})
      
        box.iApUpgrade = true;
        box.receipt = e.transaction.originalReceipt
        box:save();
        removeLocking()

    
    elseif e.transaction.state == "failed" then    
        native.showAlert("Failed", "Your purchase failed. Please, try again.", {"OK"})
    elseif e.transaction.state == "cancelled" then    
        native.showAlert("Cancelled", "Your transaction was cancelled. Please, try again.", {"OK"})    
    end
end)


[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,561 posts
  • Enterprise

It would be very helpful to have the actual error message you're getting regarding app thinning. Also for the black screen, there are likely errors in your device's console log. You can tether the AppleTV to your computer (you will need a USB-C cable to connect the AppleTV to your mac) and then use Xcode's Windows->Devices option to get to the AppleTV device console. Please post those errors here as well.

 

Thanks

Rob



[TOPIC: post.html]
#3

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

Here is the error message: "While processing your tvOS app, XXXXXX 1.0(2016.12.151323), errors occurred in the app thinning process, and your app couldn’t be thinned. If your app contains bitcode, bitcode processing may have failed. Because of these errors, this build of your app will not be able to be submitted for review or placed on the App Store. For information that may help resolve this issue, see Tech Note 2432."

[TOPIC: post.html]
#4

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

I will look into this, I think I know what the issue is.

[TOPIC: post.html]
#5

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

Ok i just pushed a plugin update for store kit for apple tv



[TOPIC: post.html]
#6

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

it may take an hour before updates take affect



[TOPIC: post.html]
#7

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

Hi! 

 

I have tried again but it doesn't work. 

 

When I follow the documentation and using this in build.settings

["plugin.storeKit"] = {
        publisherId = "com.scottrules44",
},

I get this error when trying to upload the app.

 

 

ERROR ITMS-90171: "Invalid Bundle Structure - The binary file 'Deep Ocean Aquarium.app/Frameworks/Corona_plugin_storeKit.framework/Corona_plugin_storeKit' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the tvOS app bundle structure."

 

 

When adding 'supportedPlatforms' I can upload to iTunesConnect/Testflight...

["plugin.storeKit"] = {
          publisherId = "com.scottrules44",
          supportedPlatforms = { tvos=true },
      },

...but then it looks like the plugin is not included in the build.

[Device] ERROR: Runtime error
[Device] Runtime Error: Runtime error: module 'plugin.storeKit' not found:resource (plugin.storeKit.lu) does not exist in archive
[Device] 	no field package.preload['plugin.storeKit']
[Device] 	no file '/var/containers/Bundle/Application/79A6A703-EAB6-4062-B284-73CCC787F0EA/Deep Ocean Aquarium.app/plugin/storeKit.lua'
[Device] 	no file '/var/containers/Bundle/Application/79A6A703-EAB6-4062-B284-73CCC787F0EA/Deep Ocean Aquarium.app/plugin/storeKit.lua'
[Device] 	no file './plugin/storeKit.so'
[Device] 	no file '/var/containers/Bundle/Application/79A6A703-EAB6-4062-B284-73CCC787F0EA/Deep Ocean Aquarium.app/plugin/storeKit.so'
[Device] 	no file './plugin.so'
[Device] 	no file '/var/containers/Bundle/Application/79A6A703-EAB6-4062-B284-73CCC787F0EA/Deep Ocean Aquarium.app/plugin.so'plugin.storeKitluaopen_plugin_storeKit
[Device] GC startmotion updates

I'm using daily build 3007.



[TOPIC: post.html]
#8

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

Fixed please try rebuilding

[TOPIC: post.html]
#9

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

Now I can build and copy to device if I exclude  

--supportedPlatforms = { tvos=true },

 in build.settings. But Then I can't upload to iTunes Connect because of the App thinning problem.

 

When I include supportedPlatforms I can upload to iTunes connect and copy to device but then the device can't find the plugin. 

supportedPlatforms = { tvos=true },


[TOPIC: post.html]
#10

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

that is odd, what version of corona are you running? It may be a corona bug.



[TOPIC: post.html]
#11

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

I'm using the latest daily build. 3007



[TOPIC: post.html]
#12

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

I'm using the latest daily build. 3007

I will give this a test in a bit, but the way you were doing it above should work both ways. I mean, I only have one tvOS plugin. I would "try" the latest stable build until I figure out what is up. But will look into it



[TOPIC: post.html]
#13

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,561 posts
  • Enterprise

Keep in mind that "supportedPlatforms" is exclusionary. That is if you leave it out, it says include the plugin for any platform. If you include it, it says only load it for that particular platform. If you're building for a platform that the plugin is valid for, having the line and not having it are identical. 

 

Please post your complete build.settings.

 

Thanks

Rob



[TOPIC: post.html]
#14

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

settings = 
{

        plugins =
        {
            ["plugin.onDemandResources"] =
            {
                publisherId = "com.coronalabs",
                supportedPlatforms = { appletvos=true }
               
            },
            
            --[
            ["plugin.storeKit"] = {
                publisherId = "com.scottrules44",
                --supportedPlatforms = { tvos=true },
            },
            --]]      
            
        },
        
        --[[]
        osx = {
        	entitlements = {
	            ["com.apple.security.network.client"] = true,
        	},
	},
        --]]

	
	tvos =
	{
                          
                onDemandResources =
                {  
                    { tag="TwilightPartB", resource="odr/02.mp4", type="install" },
                    { tag="MidnightPartA", resource="odr/03.mp4", type="install" },
                    { tag="MidnightPartB", resource="odr/04.mp4", type="install" },
                },
                          
                
		-- tvOS app icons require multiple layers, and you must provide both a small and a large size
		icon =
		{
			-- A collection of 400x240 pngs, in order of top to bottom
			small =
			{
				"Icon-tvOS-Small-LogoA.png",
				"Icon-tvOS-Small-LogoB.png",
				"Icon-tvOS-Small-Background.png",
			},
			-- A collection of 1280x768 pngs, in order of top to bottom
			large =
			{
				"Icon-tvOS-Large-LogoA.png",
				"Icon-tvOS-Large-LogoB.png",
				"Icon-tvOS-Large-Background.png",
			}
		},

		-- A 1920x720 image file, displayed when your app is on the "top shelf"
                topShelfImage = "Icon-tvOS-TopShelf.png",

                -- A 2320x720 image file, displayed when your app is on the "top shelf" of a widescreen TV
                topShelfImageWide = "Icon-tvOS-TopShelfWide.png",

                -- A 1920x1080 png file, displayed briefly as your app loads
                launchImage = "Icon-tvOS-Launch.png",
                

        
	},
        



	excludeFiles =
	{
		-- Exclude all Android icon files and .ogg files
		iphone = { "Icon-*dpi.png", "*.ogg" },

		-- Exclude iOS "retina" image files and .aac files
		android = { "Icon.png", "*@2x.png", "*.aac" },

		-- Exclude unnecessary assets from OS X desktop apps
		osx = { "Default*.png", "Icon*.png", "Icon*.ico", "Icon*.icns", "*.aac" },

		-- Exclude unnecessary assets from Win32 desktop apps
		win32 = { "Default*.png", "Icon*.png", "Icon*.ico", "Icon*.icns", "*.aac" },

		-- Exclude all Android icon files and .ogg files
		tvos = { "Icon-*.png", "*.ogg" },
	},

	orientation =
	{
		default = "landscapeLeft",
		supported = { "landscapeLeft", "landscapeRight" },
	},

	window =
	{
		suspendWhenMinimized = true,
		defaultViewWidth = 960,
		defaultViewHeight = 640,
		titleText =
		{
			default = "Pew Pew!",
		},
	},
}


[TOPIC: post.html]
#15

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

I just tried to use build 2992 (latest public build) but no still the same problem...

 

---

While processing your tvOS app, XXXXXXXXX.0(2016.12.211454), errors occurred in the app thinning process, and your app couldn’t be thinned. If your app contains bitcode, bitcode processing may have failed. Because of these errors, this build of your app will not be able to be submitted for review or placed on the App Store. For information that may help resolve this issue, see Tech Note 2432.



[TOPIC: post.html]
#16

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

I pushed out update.

[TOPIC: post.html]
#17

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

Thanks! I will make a test asap. :)



[TOPIC: post.html]
#18

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

Hi!

 

It looks like the IAP is working now. both with 2992 and the latest build, 3011. Thanks!

 

But it looks like store.restore() doesn't work? When calling store.restore() nothing is returned. In store.init I'm checking for e.isError but isError is nil. Also e.transaction.state is nil.

 

Then there is a very odd thing. After the purchase I'm moving to a new scene and try to play an audiofile but all audio channels seems to be muted in someway (only after purchase). It's impossible to play an audiofile and even if I'm loading the audiofile again or changing the volume is still muted. After trying maybe 100+ different solutions only work-around I have found is to remove all scenes and reload the main-menu. Maybe this isn't connected to storeKit at all but it only happens right after a purchase (tvos). 



[TOPIC: post.html]
#19

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

I can look into the restore not working, I don't know about the audio bug. I will see what I can do. Thanks for your patience.

[TOPIC: post.html]
#20

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,561 posts
  • Enterprise

I can't speak for Scott's implementation but in our store.* API (IAP for iOS) The restore action will only return items if the user has made purchases of non-consumable items and they've deleted and re-installed the app. There is not a "there is nothing to restore" event. Go "restore doing nothing" is a perfectly valid state.

 

Rob



[TOPIC: post.html]
#21

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

I have it set to nil if there nothing to restore.

[TOPIC: post.html]
#22

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

On iOS and mac audio does not stop, this seems unique to tvOS. I believe this corona bug and I would submit a bug report, I mean I am willing to corona support if they need anything. But i mean iOS, MacOS, and tvOS plugins all the same lines of code( mac is a hair different with some security protocols).



[TOPIC: post.html]
#23

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

I am away from the apple tv until jan 3 so I don't really have a way to test this until then. Thanks, Scott



[TOPIC: post.html]
#24

mfr

[GLOBAL: userInfoPane.html]
mfr
  • Enthusiast

  • 56 posts
  • Corona SDK

Thanks for the update. StoreKit is working and the app is in review.

 

But the audio doesn't work as it should. If one play a audiostream before purchase the audio will be "muted" after purchase. But will work again after leaving the app and going back again. Maybe a bug in Corona.



[TOPIC: post.html]
#25

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,561 posts
  • Enterprise

I don't see how this would be a Corona bug. What's likely happening is Apple's StoreKit framework is muting the sound and not turning it back on. Perhaps you could try to print out the volume on the channel that's being muted or the master volume in the listener function and if you see it's set to 0, then set the volume back to something that works for your app.

 

 

Rob




[topic_controls]
Page 1 of 4 1 2 3 »
 
[/topic_controls]