FBInstant inited undefined (SOLVED)

We start our Facebook instant game build on localhost using this instruction:
https://developers.facebook.com/docs/games/instant-games/test-publish-share

We have no problems with Windows environment, but we have problems with Mac OS X. The console log:

dmloader.js:303 INFO:ENGINE: Defold Engine 1.2.134 (b2ef3a1)
printErr @ dmloader.js:303
2gun.js:1 WebGL: INVALID_ENUM: getParameter: invalid parameter name
emscriptenWebGLGet @ gun.js:1
dmloader.js:303 INFO:ENGINE: Loading data from: dmanif:./game.dmanifest
printErr @ dmloader.js:303
gun.js:1 The Web Audio autoplay policy will be re-enabled in Chrome 70 (October 2018). Please check that your website is compatible with it. https://goo.gl/7K7WLu
_dmDeviceJSOpen @ gun.js:1
dmloader.js:303 INFO:ENGINE: Initialised sound device 'default'
printErr @ dmloader.js:303
dmloader.js:303 
printErr @ dmloader.js:303
gun.js:1 FBInstant inited undefined
dmloader.js:303 DEBUG:SCRIPT: init

Has anyone got this problem?

The “FBInstant inited undefined” is this check:

Which basically checks if FBInstant has been initialized before the Defold app has been loaded, ie initialized from HTML and Javascript, like this:

There is no requirement that you do this, and if you don’t then you need to make sure to initialize FBInstant from Lua instead. Like this:

	fbinstant.initialize(function(self, success)
		if not success then
			print("ERROR! Unable to initialize FBInstant")
			return
		end
		
		fbinstant.start_game(function(self, success)
			if not success then
				print("ERROR! Unable to start game")
				return
			end
			... ready to play here!
		end)
	end)

There is no harm in doing both. If you’ve initialized from HTML and Javascript then the init call from Lua will succeed immediately.

2 Likes

Thank you. We will solve this problem.

1 Like