Update: I missed this - _“On iOS 9 and above, the Share Dialog will use a SFSafariViewController.” - _so the issue is identified, and my question remains. Can I revert to the previous Facebook plugin?
Hi, I’m guessing this has something to do with the most recent Facebook plugin update.
When I now request the dialog, it’s showing what looks like a web popup on both iOS and Android. There are two problems with this:
- It’s more cumbersome. I now need to hit the share to Facebook button twice, and sign in to Facebook manually via the web popup before I’m able to share. Before it was a one-click process that felt native.
- I’m sharing a link to a picture, and it doesn’t seem to preview the picture on iOS 10 anymore (iOS 9 it still does).
I last tested my Facebook code a week ago (working fine) and now when I test the exact same code, it no longer works.
I’ve also read the docs here:
https://docs.coronalabs.com/plugin/facebook-v4/showDialog.html
and here:
https://docs.coronalabs.com/plugin/facebook-v4/showDialog.html#sharedialog
Here’s my code:
[lua]
local M = {}
local facebook = require( “plugin.facebook.v4” )
local fbAppID = XXXXXXXXXXX
local loadsave = require(“scripts.mod_loadsave”)
local json = require(“json”)
– FACEBOOK LOGIN –
local picUrl
local function shareToFb()
local shareOptions = {
link = picUrl,
title = “London Tube Quiz”
}
facebook.showDialog( “link”, shareOptions )
end
local function facebookListener( event )
print(“in facebook listener”)
print(event.type)
if ( “session” == event.type ) then
if ( “login” == event.phase ) then
if event.token then
print(“got FB session token”)
local params = {
fields = “first_name,last_name,email”
}
facebook.request( “me”, “GET”, params )
end
shareToFb()
end
elseif (“request” == event.type) then
if not event.isError then
print("RESPONSE IS " … event.response)
local response = json.decode( event.response )
if response.email then
print("email is " … response.email)
end
end
elseif ( “dialog” == event.type ) then
print( event.response )
end
end
local function fbLogin( link_to_pic )
print(link_to_pic)
picUrl = link_to_pic
print(“logging in”)
if ( facebook.isActive ) then
if ( facebook.getCurrentAccessToken() == nil ) then
print( “Login required!” )
facebook.login( facebookListener, {“email”} )
else
print( “Already logged in. Sharing…” )
shareToFb()
end
else
print( “Please wait for facebook to finish initializing before checking the current access token” )
native.showAlert( “Please Try Again”, “Facebook has not yet loaded - please try again in a couple of minutes. If that doesn’t work, try restarting the app.”, { “OK” } )
end
end
M.fbLogin = fbLogin
return M[/lua]
-
Am I doing anything wrong/am I missing some update that I’m required to make?
-
If this is a feature and not a bug, is there a way I can build using the previous beta version of the Facebook V4 plugin?.. it worked fine a week ago…
Thanks in advance - look forward to hearing back!
Ed
P.S. I don’t actually have a screenshot - but found the attached picture online for clarity - to show the behaviour I want (and was getting 1 week ago).