Post photos in Facebook for High Score

Hello, I want to post in a High Score in Facebook, and I had used the example of Corona SDK and it is running right.

The problem is, when I change the image, for my image the post failed.

example code:

if fbCommand == POST_PHOTO then

local attachment = {

name = “Developing a Facebook Connect app using the Corona SDK!”,

link = "http://www.coronalabs.com/links/forum",

caption = “Link caption”,

description = “Corona SDK for developing iOS and Android apps with the same code base.”,

picture = "http://www.coronalabs.com/links/demo/Corona90x90.png",

actions = json.encode( { { name = “Learn More”, link = “http://coronalabs.com” } } )

}

facebook.request( “me/feed”, “POST”, attachment ) – posting the photo

end

I change for, the file is in my folder

picture = “logo.png”,

Thank You

Please try to build the Facebook sample app and see if that works for you.  If it does, see how your code differs from the Sample App. 

Rob

Hi @mperezsoriano,

For posting photos localized to your app, the method differs slightly. Please see the guide here for details:

http://docs.coronalabs.com/guide/social/implementFacebook/index.html#making-requests

Brent

Hello Brent, thank you for your answer, but if I write the code expecificate in this page.

local attachment = {
message = “My text”,
source = {
baseDir=system.DocumentsDirectory,
filename=“logo.png”,
type=“image”
}
}

facebook.request( “me/photos”, “POST”, attachment )

The return is POST FAILED.

Is that file located in the app’s Documents directory? If it’s in the Resource directory, it won’t find the file, and thus it will fail.

Brent

Hello  Brent thank you for your aswer, the code at rhe end is:

if fbCommand == POST_PHOTO then

local attachment = {

message = “HIGHT SCORE 1600 POINTS”,

source = {

baseDir=system.ResourceDirectory, 

        filename=“logo.png”,

        type=“image”

        }

}

facebook.request( “me/photos”, “POST”, attachment ) – posting the photo

end.

Kind regards.

Manuel

Manuel.

For your information, Facebook rejected my review dueto adding a message to the photo:

http://forums.coronalabs.com/topic/51699-post-photo-to-facebook-using-facebookshowdialog/?hl=%2Bupload+%2Bphoto

Facebook is not permitting filled out messages any longer.

Rob

Hey Rob,

Sure?

Mine was rejected 4 weeks ago.

So they changed it?

Best regards

It’s been in their ToS since 2011 (ish) but they’ve only recently (this year, with new app review process) been enforcing it.

Even if you manage to sneak one by their reviewers, if they later learn about it (probably via a complaint, tho there are ‘rumors’ they can detect auto-fill spam patterns) then you’ll get a notice telling you to correct it or get banned, and if no corrective action then banned.  hth

Christian, I think you might have mis-read me.  Facebook is rejecting apps that pre-fill out text.

Rob

You’re right Rob  :-D

I misinterpret your “Facebook is not permitting filled out messages any longer.” because that was my tip to the other guys in my previous post ^^

Please try to build the Facebook sample app and see if that works for you.  If it does, see how your code differs from the Sample App. 

Rob

Hi @mperezsoriano,

For posting photos localized to your app, the method differs slightly. Please see the guide here for details:

http://docs.coronalabs.com/guide/social/implementFacebook/index.html#making-requests

Brent

Hello Brent, thank you for your answer, but if I write the code expecificate in this page.

local attachment = {
message = “My text”,
source = {
baseDir=system.DocumentsDirectory,
filename=“logo.png”,
type=“image”
}
}

facebook.request( “me/photos”, “POST”, attachment )

The return is POST FAILED.

Is that file located in the app’s Documents directory? If it’s in the Resource directory, it won’t find the file, and thus it will fail.

Brent

Hello  Brent thank you for your aswer, the code at rhe end is:

if fbCommand == POST_PHOTO then

local attachment = {

message = “HIGHT SCORE 1600 POINTS”,

source = {

baseDir=system.ResourceDirectory, 

        filename=“logo.png”,

        type=“image”

        }

}

facebook.request( “me/photos”, “POST”, attachment ) – posting the photo

end.

Kind regards.

Manuel

Manuel.

For your information, Facebook rejected my review dueto adding a message to the photo:

http://forums.coronalabs.com/topic/51699-post-photo-to-facebook-using-facebookshowdialog/?hl=%2Bupload+%2Bphoto

Facebook is not permitting filled out messages any longer.

Rob

Hey Rob,

Sure?

Mine was rejected 4 weeks ago.

So they changed it?

Best regards