A Fuse Powered Company

Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Posting facebook post with an actions (json.encode)
Started by gazjm Aug 09 2013 03:25 PM

6 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

gazjm

[GLOBAL: userInfoPane.html]
gazjm
  • Pro
  • PipPipPipPipPipPip
  • 141 posts
  • Jedi

Hi,

 

When posting a post with an image using, (but with my text etc)

 

 

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" } } )            }
 

 

 

if I have the below on the bottom

 

 

 

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

 

 

the post doesn't appear.  If I remove it then it does.  Is this no longer supported?  As I could do with having the learn more link to my site / app, and the link in the attachment to the image itself.

 

Thanks

 

Gary

 

Gary



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 10,421 posts
  • Jedi

Can you provide more details about what you are trying to accomplish.  Can you also post your facebook.request() call and any setup for that?

 

Also what version of Corona SDK are you using, what device are you building for and testing?

 

Has it worked before?

 

Can you do other facebook.requests()'s successfully?



[TOPIC: post.html]
#3

gazjm

[GLOBAL: userInfoPane.html]
gazjm
  • Pro
  • PipPipPipPipPipPip
  • 141 posts
  • Jedi

Hi,

 

I am posting a link with an image of my google maps location.  but would like the read more link to link to my app / web page.  if i change the link in the main attachments code to my website the link seems to struggle finding the image to show in Facebook.  

 

Other facebook requests seem to work ok, just when the actions part is added it doesn't post.

 

 


its the first time I have tried it with this app.

 

Im on daily build 1182 

 

My code is 

 

 

 

function faceBookButton:touch(event)
 if event.phase == "began" then
event.target.xScale = 1.5
event.target.yScale = 1.5 
local facebook = require "facebook"


local function listener( event )
 if ( "session" == event.type ) then
        -- upon successful login, request list of friends of the signed in user
        if ( "login" == event.phase ) then
        
         local attachment = {
                name = "I'm out on a ride using CycleMate for iOS & Android",
                link = "http://maps.google.com/maps/api/staticmap?center=" .. currentLatitude .. "," .. currentLongitude .. "&zoom=16&markers=" ..  currentLatitude .."," .. currentLongitude .. "&size=500x300&sensor=false",
                caption = "Current Distance: " .. string.format( '%.1f', distanceTravelled ),
                description =  "CycleMate allows you to share your location & images by email / facebook / twitter.  CycleMate also has a speedometer and mileometer.  It is the all in one app for cyclists",
                picture = "http://maps.google.com/maps/api/staticmap?center=" .. currentLatitude .. "," .. currentLongitude .. "&zoom=16&markers=" ..  currentLatitude .."," .. currentLongitude .. "&size=500x300&sensor=false"
                actions = json.encode( { { name = "Learn More", link = "http://www.gjmullen.co.uk" } } )
        
            }
             
             facebook.request( "me/feed", "POST", attachment )    
     end
     end
end


-- NOTE: You must provide a valid application id provided from Facebook
local appId = "xxxxxxxxxxxxxxx"
if ( appId ) then


        facebook.login( appId, listener, {"publish_stream"} )
    
else
       
        local function onComplete( event )
                system.openURL( "http://developers.facebook.com/setup" )
        end


        native.showAlert( "Error", "To develop for Facebook Connect, you need to get an application id from Facebook's website.", { "Learn More" }, onComplete )
end


  else
  event.target.xScale = 1
    event.target.yScale = 1
 end
end
 


[TOPIC: post.html]
#4

gazjm

[GLOBAL: userInfoPane.html]
gazjm
  • Pro
  • PipPipPipPipPipPip
  • 141 posts
  • Jedi

building for ios 6 and using an iphone 5



[TOPIC: post.html]
#5

gazjm

[GLOBAL: userInfoPane.html]
gazjm
  • Pro
  • PipPipPipPipPipPip
  • 141 posts
  • Jedi

sorry, my bad.  I didn't load the json library.

 

thanks



[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 10,421 posts
  • Jedi

Just to make sure, you're good to go now?



[TOPIC: post.html]
#7

gazjm

[GLOBAL: userInfoPane.html]
gazjm
  • Pro
  • PipPipPipPipPipPip
  • 141 posts
  • Jedi

Hi,

 

Yes good to go. The google maps static image shown in the picture box when  I have the actions line in doesn't seem to work properly,  It just shows the ocean rather than showing the location,  so I've ended up not using the actions line anyhow as it works properly without it.

 

Thanks

 

Gary




[topic_controls]
[/topic_controls]