The more features we add to our extension system, the more extensions we can remove from the core engine and move out into a proper extension. This has several benefits, such as the engine becoming smaller for those that don’t use a certain extension. Or that the extension can be updated or improved upon by our users, depending on their needs.
In any case, it’s now time for our Facebook functionality to move out into a proper extension.
The planned release for this extension is in 1.2.154.
Transition
To retain your facebook support, you’ll need to add a dependency to your game.project, and that’s it.
The Lua module will work just as before.
(We’ll share the exact dependency link at the time of the release.)
In app purchases
We’ll move the iap module into a separate extension at a later stage.
Gameroom
We are also planning to move the Gameroom (Win32) extension out at a later stage.
Preliminary engine size saves
For Android, the classes.dex became ~610kb smaller.
For iOS, the engine became ~400kb smaller
I experienced with the new facebook extension and got it running with 1.2.156, but found a showstopper as I tried to add a simple “share to facebook-feed” button in my game.
I followed the examples to get publish permissions and made a call to facebook.show_dialog(dialog, param, callback) to test it out. When I tested it on iOS device, the app asked to launch facebook app, but when it started I got an error message: "Invalid Scopes: publish_actions. This message is only shown to developers. Users of your app will ignore these permissions if present. Please read the documentation for valid permissions at: https://developers.facebook.com/docs/facebook-login/permissions "
I checked and it seems like facebook have removed “publish_actions” -permissions and have created a new Sharing products for this use case.
Facebook - Breaking Changes: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#login-4-24 “The publish_actions permission has been removed. Apps that have already been approved for publish_actions can continue using the permission until August 1st, 2018. If you want to provide a way for your app users to share content to Facebook and Instagram beyond this date, we encourage you to use our Sharing products instead.”
What is the current de-facto way to create a sharing dialog in a game made with defold?
local permissions = {"publish_actions"}
local function facebook_module_fb_share(self, result, error)
if error then
-- something did not go right...
else
-- do something sensible
end
end
function facebook_module_login_with_publish()
facebook.login_with_publish_permissions(permissions, facebook.AUDIENCE_FRIENDS, function(self, data)
if (data.status == facebook.STATE_OPEN and data.error == nil) then
print("Successfully logged into Facebook")
pprint(facebook.permissions())
local param = { link = "http://www.helmigames.com",picture="http://www.helmigames.com/wp-content/uploads/2017/01/helmiL.png" }
facebook.show_dialog("feed", param, facebook_module_fb_share)
else
print("Failed to get permissions (" .. data.status .. ")")
pprint(data)
end
end)
end
I simply require the facebook_module in a gui script and call the facebook_module_login_with_publish() function from a button click.
I tested the functionality by making a TestFlight release and using iOS device. Facebook app opens up as expected and asks if a connection to my game would be made by signing in with my facebook-account, but after accepting, the facebook app displays the error message I pasted above.
Yes, this is our old (internal) example. We’ve merely moved the code outside of the engine.
What permissions you wish to use is individual per app basis.
In the Facebook official documentation they’re using publish_to_groups: doc
Thanks. I updated to use publish_to_groups -permissions and I no longer get the error messages. Using the show_dialog() function only seems to make a successful login to facebook but did not open the share to feed -dialog as I expected.
Is there something I’m missing to make a share to facebook feed working?
We just made a pre-release of a new version of the Facebook extension available for testing. The new version is based on the latest Facebook SDK version 5.9.0. It fixes login issues on iOS 13 (although this is also partially dependant on the upcoming Defold 1.2.164 release).
Please help us test the extension by adding the following two dependencies to your game.project file:
Thanks. Could I please ask you to lock down more of your dependency versions? It’s very hard to promise any kind of stability when you depend on master.zip since that can change without notice. Please use these instead: