v4a Sample App - Not working as expected

Hi, i want to migrate my existing app to the v4a version of the plugin.

I thougt the best way would be just to use the sample app from the SDK (latest daily build 2018.3333) and see how it works.

I inserted my fb app ID in the build settings (local myFacebookAppID  = …) and compiled the
app for IOS,

When I start the app on an IOS device where facebbook is installed and enabled the app is responding
like so:

00:05 Button Facebook app enabled? > true
00:11 Button Login > opens Safari and prompts the user to login via Facebook App

00:38 Button Get user > shows the correct user (Anton Huber)

00:45 Button Share photo dialog > prompts again with Safari and a user login page, but will never show a share photo dialog…returning back to app.

here is a smal video I made from the app running on the device

https://1drv.ms/v/s!Atfu_YioThG-nKJzWqfLAGnb5Bmn9A

Is there something I am missing?
Btw…my App in FB Developer Center is still in development status.

What I want to achieve is this:

  • Silent login to facebook when the user opens my app
  • Ability to post a photo to the the users facebook timeline or a facebook page which is owened by the user.

Maybe someone could share a view lines of code … :wink:
Thanks for any help.

Andreas
 

There seems to be something amiss with the sample app. We removed some default permissions with 3326 but I’m pretty sure we tested that app before the public release. I’ll need to figure out what’s borked about it.

Rob

Hi Rob,

I tried the sample App now from 3208 and got simular results.
 

Maybe I miss something in my FB App setup.

Just need to be sure that the sample App is working as designed so I can keep
on investigating on my FB App settings.

Thanks Andreas

I spent some time today working on the sample app. We don’t have a completely updated version. When we do it will show up in the SampleCode for the daily build it goes out in.  But there are two immediate things you can fix to get this working.

Around line 158 (or 159 since we removed another line higher up in the code), change the function: needPublishActionPermission() to

local function needPublishActionsPermission() return requestedFBCommand ~= LOGIN and requestedFBCommand ~= SHOW\_REQUEST\_DIALOG and requestedFBCommand ~= GET\_USER\_INFO and requestedFBCommand ~= PUBLISH\_INSTALL and requestedFBCommand ~= IS\_FACEBOOK\_APP\_ENABLED and requestedFBCommand ~= LOGOUT and requestedFBCommand ~= SHARE\_PHOTO\_DIALOG and requestedFBCommand ~= SHARE\_LINK\_DIALOG end

Note the addition of the last two lines in the sequence.

Then our code to upload images was dependant on URLs to images that have been removed and were generating 404 errors. We don’t like our solution either since it’s still dependant on a blog post image that may change in the future, but for now, it will get the sample app working.  At line 143, remove the two URLs and replace them with a single entry for now:

 elseif requestedFBCommand == SHARE\_PHOTO\_DIALOG then -- Create table with photo data to share local photoData = { photos = { { url = "https://coronalabs.com/wordpress/wp-content/uploads/2018/07/orange\_vertikal\_RGB.png", }, }, } response = facebook.showDialog( "photo", photoData ) 

Now to the next issue. If we use the share links button or the share request button, it properly asks me if me want to login and share using the FB app. For some reason, for share photos, it makes me login through the web interface (on iOS, didn’t test on Android). There isn’t anything in our code that would seem to control that.

Finally, the app is still using “publish_actions” for several buttons which is a permission that’s going away for new apps and will eventually go away for existing apps. Before we can update a complete version of this, we need to remove these buttons and actions or replace them with some equivalent new feature.

For now, use these changes to get you going.

Rob

Hi Rob,

it is still not working. On almost every action a Safari window pops up and is asking me to login again.

However, after a couple of open and closing the safari window I was able to share a photo with the share photo dialog, but still this was a safari web dialog and not from the native facebook app.

I wonder why it will always opening the web facebook and not the native facebook app ???

Andreas

The “publish_actions” permission is now gone from facebook :frowning: and the facebook sample app doesn’t work, showing an error about “publish_actions” on most buttons. It’s time for corona to update their facebook sample app please

We are aware of this and it’s in our queue to work on.

Rob

Any ETA on updated facebook code? It’s been 22 days now since FB turned off publish_actions (plus they gave a bunch of advance notice).

It would be great if Corona used this as an opportunity to get the facebook share dialog working really well. I would love support for posting local images along with a description (not currently supported).

The sample app was updated August 9th. You will need to download a later daily build to get the update sample.

However, we have not updated the plugin with any changes to the share dialogs.

Rob

There seems to be something amiss with the sample app. We removed some default permissions with 3326 but I’m pretty sure we tested that app before the public release. I’ll need to figure out what’s borked about it.

Rob

Hi Rob,

I tried the sample App now from 3208 and got simular results.
 

Maybe I miss something in my FB App setup.

Just need to be sure that the sample App is working as designed so I can keep
on investigating on my FB App settings.

Thanks Andreas

I spent some time today working on the sample app. We don’t have a completely updated version. When we do it will show up in the SampleCode for the daily build it goes out in.  But there are two immediate things you can fix to get this working.

Around line 158 (or 159 since we removed another line higher up in the code), change the function: needPublishActionPermission() to

local function needPublishActionsPermission() return requestedFBCommand ~= LOGIN and requestedFBCommand ~= SHOW\_REQUEST\_DIALOG and requestedFBCommand ~= GET\_USER\_INFO and requestedFBCommand ~= PUBLISH\_INSTALL and requestedFBCommand ~= IS\_FACEBOOK\_APP\_ENABLED and requestedFBCommand ~= LOGOUT and requestedFBCommand ~= SHARE\_PHOTO\_DIALOG and requestedFBCommand ~= SHARE\_LINK\_DIALOG end

Note the addition of the last two lines in the sequence.

Then our code to upload images was dependant on URLs to images that have been removed and were generating 404 errors. We don’t like our solution either since it’s still dependant on a blog post image that may change in the future, but for now, it will get the sample app working.  At line 143, remove the two URLs and replace them with a single entry for now:

 elseif requestedFBCommand == SHARE\_PHOTO\_DIALOG then -- Create table with photo data to share local photoData = { photos = { { url = "https://coronalabs.com/wordpress/wp-content/uploads/2018/07/orange\_vertikal\_RGB.png", }, }, } response = facebook.showDialog( "photo", photoData ) 

Now to the next issue. If we use the share links button or the share request button, it properly asks me if me want to login and share using the FB app. For some reason, for share photos, it makes me login through the web interface (on iOS, didn’t test on Android). There isn’t anything in our code that would seem to control that.

Finally, the app is still using “publish_actions” for several buttons which is a permission that’s going away for new apps and will eventually go away for existing apps. Before we can update a complete version of this, we need to remove these buttons and actions or replace them with some equivalent new feature.

For now, use these changes to get you going.

Rob

Hi Rob,

it is still not working. On almost every action a Safari window pops up and is asking me to login again.

However, after a couple of open and closing the safari window I was able to share a photo with the share photo dialog, but still this was a safari web dialog and not from the native facebook app.

I wonder why it will always opening the web facebook and not the native facebook app ???

Andreas

The “publish_actions” permission is now gone from facebook :frowning: and the facebook sample app doesn’t work, showing an error about “publish_actions” on most buttons. It’s time for corona to update their facebook sample app please

We are aware of this and it’s in our queue to work on.

Rob

Any ETA on updated facebook code? It’s been 22 days now since FB turned off publish_actions (plus they gave a bunch of advance notice).

It would be great if Corona used this as an opportunity to get the facebook share dialog working really well. I would love support for posting local images along with a description (not currently supported).

The sample app was updated August 9th. You will need to download a later daily build to get the update sample.

However, we have not updated the plugin with any changes to the share dialogs.

Rob