Posting an image and/or screenshot to the user's Facebook wall

Hello,

I’ve been trying (for the past 2 days) to post an image located on the Ressource directory of the app to the user’s wall.

Logging in, Posting an image located on the web (like in the Facebook sample code) works great, Posting an image works great.

However, when trying to post an image from system.RessourceDirectory or System.DocumentsDirectory, using the code below:

local attachment = {  
 message = "Just a description of the photo.",  
 source = { baseDir=system.ResourceDirectory, filename="iheartcorona.jpg", type="image" }  
 }  
  
 facebook.request( "me/photos", "POST", attachment )  

from :
http://www.coronalabs.com/blog/2011/12/16/uploading-photos-to-facebook-in-corona/

It’s a fail.

This used to work before (as i already published apps with this code).

Unfortunately, since i am trying to post screenshots, i don’t have the option to use webbased images.

I’d like to make sure that the problem comes from Corona before logging in a bug.

Anyone else experiencing the same issue?

d.

[import]uid: 100310 topic_id: 35955 reply_id: 335955[/import]

@dimd, I don’t know if the problem is related to the breaking changes Facebook made, but if you haven’t updated the permissions to include publish_actions (instead of the outdated publish_stream) on Facebook developer dashboard, you might want to update it.

Also, there has been Facebook SDK update related fixes made to Corona SDK. If you haven’t done so, you just might want to download the latest daily build 1030. With daily build 1030, you need to add FacebookAppID to build.settings:

plist=  
{  
 FacebookAppID = "xxxxxxxxxxxxxx",  
 CFBundleURLTypes =  
 {  
 {  
 CFBundleURLSchemes =  
 {  
 "fbxxxxxxxxxxxxxx",  
 },  
 },  
 },  
},  

See Tom’s post #82:
http://developer.coronalabs.com/forum/2012/12/30/facebook-311-sdk-breaks-lot?page=1#comment-142641

Naomi [import]uid: 67217 topic_id: 35955 reply_id: 142893[/import]

Hey Naomi,

Thanks for the reply.

My build.settings is fine and working since i can post images from the web. I use build 1030, with the modified plist.

The app on FB was created not long ago, so i think that by default, new apps are already compliant to FB breaking changes. Anyway, i double-checked with another (older) app that i have that can post without problems, settings in SETTINGS/ADVANCED are the same (it’s the only place to update, right?)

Anyway, to test it out, i tried the sample code with publish_actions, and it works fine either way (publish_stream or publish_actions).
But the code to upload an image from the device doesn’t exist in the sample code.

That code that i took from the tutorial of JBeebe, fails everytime:

local postMsg = {   
 message = "Posting from Corona SDK! ",  
 source = {  
 baseDir=system.ResourceDirectory,   
 filename="test.jpg",  
 type="image"},  
 }  
  
facebook.request( "me/feed", "POST", postMsg )  

Something has changed lately with the FB code of Corona i believe. It used to work, but is broken since Feb breaking changes. Showstopper for my app.

Maybe Corona could gently update the sample code with the new publish_actions to show how to post an image. Maybe a blogpost. That’d be terrific. Tom?

d. [import]uid: 100310 topic_id: 35955 reply_id: 142910[/import]

Hey, @dimd, I’m pretty sure that updating the sample code is in the works.

BTW, unfortunately, it turned out that the daily build 1030 broke my facebook related code, so I’m going to wait for another update/fix. As far as posting an image from ResourceDirectory to “me/photos”, I never needed to invoke this particular facebook.request, so I’m sorry I don’t have the first hand experience to share.

Edit: Woops, my bad, it was a simple error in my code. When I consolidated FB listeners into a single listener, I missed including one of the requests in session event type. With it corrected, Facebook feature is working perfectly with daily build 1030 for me. Cheers.

Naomi [import]uid: 67217 topic_id: 35955 reply_id: 142917[/import]

@dimd, I don’t know if the problem is related to the breaking changes Facebook made, but if you haven’t updated the permissions to include publish_actions (instead of the outdated publish_stream) on Facebook developer dashboard, you might want to update it.

Also, there has been Facebook SDK update related fixes made to Corona SDK. If you haven’t done so, you just might want to download the latest daily build 1030. With daily build 1030, you need to add FacebookAppID to build.settings:

plist=  
{  
 FacebookAppID = "xxxxxxxxxxxxxx",  
 CFBundleURLTypes =  
 {  
 {  
 CFBundleURLSchemes =  
 {  
 "fbxxxxxxxxxxxxxx",  
 },  
 },  
 },  
},  

See Tom’s post #82:
http://developer.coronalabs.com/forum/2012/12/30/facebook-311-sdk-breaks-lot?page=1#comment-142641

Naomi [import]uid: 67217 topic_id: 35955 reply_id: 142893[/import]

Hey Naomi,

Thanks for the reply.

My build.settings is fine and working since i can post images from the web. I use build 1030, with the modified plist.

The app on FB was created not long ago, so i think that by default, new apps are already compliant to FB breaking changes. Anyway, i double-checked with another (older) app that i have that can post without problems, settings in SETTINGS/ADVANCED are the same (it’s the only place to update, right?)

Anyway, to test it out, i tried the sample code with publish_actions, and it works fine either way (publish_stream or publish_actions).
But the code to upload an image from the device doesn’t exist in the sample code.

That code that i took from the tutorial of JBeebe, fails everytime:

local postMsg = {   
 message = "Posting from Corona SDK! ",  
 source = {  
 baseDir=system.ResourceDirectory,   
 filename="test.jpg",  
 type="image"},  
 }  
  
facebook.request( "me/feed", "POST", postMsg )  

Something has changed lately with the FB code of Corona i believe. It used to work, but is broken since Feb breaking changes. Showstopper for my app.

Maybe Corona could gently update the sample code with the new publish_actions to show how to post an image. Maybe a blogpost. That’d be terrific. Tom?

d. [import]uid: 100310 topic_id: 35955 reply_id: 142910[/import]

Hey, @dimd, I’m pretty sure that updating the sample code is in the works.

BTW, unfortunately, it turned out that the daily build 1030 broke my facebook related code, so I’m going to wait for another update/fix. As far as posting an image from ResourceDirectory to “me/photos”, I never needed to invoke this particular facebook.request, so I’m sorry I don’t have the first hand experience to share.

Edit: Woops, my bad, it was a simple error in my code. When I consolidated FB listeners into a single listener, I missed including one of the requests in session event type. With it corrected, Facebook feature is working perfectly with daily build 1030 for me. Cheers.

Naomi [import]uid: 67217 topic_id: 35955 reply_id: 142917[/import]

@dimd, I don’t know if the problem is related to the breaking changes Facebook made, but if you haven’t updated the permissions to include publish_actions (instead of the outdated publish_stream) on Facebook developer dashboard, you might want to update it.

Also, there has been Facebook SDK update related fixes made to Corona SDK. If you haven’t done so, you just might want to download the latest daily build 1030. With daily build 1030, you need to add FacebookAppID to build.settings:

plist=  
{  
 FacebookAppID = "xxxxxxxxxxxxxx",  
 CFBundleURLTypes =  
 {  
 {  
 CFBundleURLSchemes =  
 {  
 "fbxxxxxxxxxxxxxx",  
 },  
 },  
 },  
},  

See Tom’s post #82:
http://developer.coronalabs.com/forum/2012/12/30/facebook-311-sdk-breaks-lot?page=1#comment-142641

Naomi [import]uid: 67217 topic_id: 35955 reply_id: 142893[/import]

Hey Naomi,

Thanks for the reply.

My build.settings is fine and working since i can post images from the web. I use build 1030, with the modified plist.

The app on FB was created not long ago, so i think that by default, new apps are already compliant to FB breaking changes. Anyway, i double-checked with another (older) app that i have that can post without problems, settings in SETTINGS/ADVANCED are the same (it’s the only place to update, right?)

Anyway, to test it out, i tried the sample code with publish_actions, and it works fine either way (publish_stream or publish_actions).
But the code to upload an image from the device doesn’t exist in the sample code.

That code that i took from the tutorial of JBeebe, fails everytime:

local postMsg = {   
 message = "Posting from Corona SDK! ",  
 source = {  
 baseDir=system.ResourceDirectory,   
 filename="test.jpg",  
 type="image"},  
 }  
  
facebook.request( "me/feed", "POST", postMsg )  

Something has changed lately with the FB code of Corona i believe. It used to work, but is broken since Feb breaking changes. Showstopper for my app.

Maybe Corona could gently update the sample code with the new publish_actions to show how to post an image. Maybe a blogpost. That’d be terrific. Tom?

d. [import]uid: 100310 topic_id: 35955 reply_id: 142910[/import]

Hey, @dimd, I’m pretty sure that updating the sample code is in the works.

BTW, unfortunately, it turned out that the daily build 1030 broke my facebook related code, so I’m going to wait for another update/fix. As far as posting an image from ResourceDirectory to “me/photos”, I never needed to invoke this particular facebook.request, so I’m sorry I don’t have the first hand experience to share.

Edit: Woops, my bad, it was a simple error in my code. When I consolidated FB listeners into a single listener, I missed including one of the requests in session event type. With it corrected, Facebook feature is working perfectly with daily build 1030 for me. Cheers.

Naomi [import]uid: 67217 topic_id: 35955 reply_id: 142917[/import]

@dimd, I don’t know if the problem is related to the breaking changes Facebook made, but if you haven’t updated the permissions to include publish_actions (instead of the outdated publish_stream) on Facebook developer dashboard, you might want to update it.

Also, there has been Facebook SDK update related fixes made to Corona SDK. If you haven’t done so, you just might want to download the latest daily build 1030. With daily build 1030, you need to add FacebookAppID to build.settings:

plist=  
{  
 FacebookAppID = "xxxxxxxxxxxxxx",  
 CFBundleURLTypes =  
 {  
 {  
 CFBundleURLSchemes =  
 {  
 "fbxxxxxxxxxxxxxx",  
 },  
 },  
 },  
},  

See Tom’s post #82:
http://developer.coronalabs.com/forum/2012/12/30/facebook-311-sdk-breaks-lot?page=1#comment-142641

Naomi [import]uid: 67217 topic_id: 35955 reply_id: 142893[/import]

Hey Naomi,

Thanks for the reply.

My build.settings is fine and working since i can post images from the web. I use build 1030, with the modified plist.

The app on FB was created not long ago, so i think that by default, new apps are already compliant to FB breaking changes. Anyway, i double-checked with another (older) app that i have that can post without problems, settings in SETTINGS/ADVANCED are the same (it’s the only place to update, right?)

Anyway, to test it out, i tried the sample code with publish_actions, and it works fine either way (publish_stream or publish_actions).
But the code to upload an image from the device doesn’t exist in the sample code.

That code that i took from the tutorial of JBeebe, fails everytime:

local postMsg = {   
 message = "Posting from Corona SDK! ",  
 source = {  
 baseDir=system.ResourceDirectory,   
 filename="test.jpg",  
 type="image"},  
 }  
  
facebook.request( "me/feed", "POST", postMsg )  

Something has changed lately with the FB code of Corona i believe. It used to work, but is broken since Feb breaking changes. Showstopper for my app.

Maybe Corona could gently update the sample code with the new publish_actions to show how to post an image. Maybe a blogpost. That’d be terrific. Tom?

d. [import]uid: 100310 topic_id: 35955 reply_id: 142910[/import]

Hey, @dimd, I’m pretty sure that updating the sample code is in the works.

BTW, unfortunately, it turned out that the daily build 1030 broke my facebook related code, so I’m going to wait for another update/fix. As far as posting an image from ResourceDirectory to “me/photos”, I never needed to invoke this particular facebook.request, so I’m sorry I don’t have the first hand experience to share.

Edit: Woops, my bad, it was a simple error in my code. When I consolidated FB listeners into a single listener, I missed including one of the requests in session event type. With it corrected, Facebook feature is working perfectly with daily build 1030 for me. Cheers.

Naomi [import]uid: 67217 topic_id: 35955 reply_id: 142917[/import]