I am trying the example code for a share dialog using the facebook module:
The vars for link, name, description, caption and picture has all been set to appropriate strings beforehand.
if(Alloy.Globals.Facebook.getCanPresentShareDialog()) {
Alloy.Globals.Facebook.presentShareDialog({
link: link,
name: name,
description: description,
caption: caption,
picture: picture
});
}
else {
Alloy.Globals.Facebook.presentWebShareDialog({
link: link,
name: name,
description: description,
caption: caption,
picture: picture
});
}
When this code is executed nothing happens.
I also added a share listener to see if any events are sent, but it is silent...
var fbShareListener = function(e){
if (e.success) {
alert(L("FB_SHARE_SUCCESS"));
Ti.API.info('Share request succeeded.');
}
else {
alert(L("FB_SHARE_FAIL"));
Ti.API.info('Failed to share.');
}
};
Alloy.Globals.Facebook.addEventListener('shareCompleted',fbShareListener);
The Facebook module seems to work otherwise, we are using it to login and linking external accounts to Arrowdb.
UPDATE:
It seems that it will give false for getCanPresentShareDialog() so it will try to run the presentWebShareDialog(). But when i look in the API docs for the facebook module this particular method documentation says: "This method has been REMOVED since 5.0.0".
The getCanPresentShareDialog also states "This method has been REMOVED since 5.0.0" in the documentation.
Anyone have any clue what to do instead?
Now they changed the docs so that it is simply to call:
presentShareDialog()
And it will handle everything on its own.
Related
I created an Application in facebook and used in my website.
In my page I am using this function to share a photo.
function postToFacebook(url, img) {
FB.ui({
method: 'feed',
link: url,
picture: img,
name: "Sample name",
description: 'sample desc'
}, function (response) {
console.log(response);
});
}
This function is working and sending a ShareLink on my Time line. But nobody can see my post. I just can see the post on my TimeLine !!!
What it is the problem?
I found out the problem myself.
it is because of the Status of Facebook Application.
Do this setting to fix the problem:
Go to Facebook Developer => You Application => Status & Review => set this option to YES:
"Do you want to make this app and all its live features available to the general public?"
I would like to enable users to share a certain feed with dynamically generated pictures. This means that the picture url is always a new one.
However, it seems that the picture Facebook is using is not that from the URL but always (an old) one from the cache.
The URL is something like http://www.domain.com/facebook/unique-picture.png
How is it possible to turn off the caching?
function shareMessage(link) {
alert(link);
FB.ui(
{
method: 'feed',
name: link,
link: 'link',
picture: link,
caption: link,
description: "description",
message: ''
});
}
https://developers.facebook.com/docs/javascript/reference/FB.ui
With the new update of Facebook API, I've been trying show a dialog for share in timeline, but don't only recognize me the href..
What can I do?
Code:
FB.ui({
name: 'Mejores Huecas',
link: 'www.lasmejoreshuecas.com',
from: '1469541393326876',
caption: 'Las mejores huecas!',
method: 'share',
href: 'https://apps.facebook.com/mejoreshuecas/?fb_source=search&ref=ts&fref=ts',
},
function(response) {
if (response && !response.error_code) {
//alert('Posting completed.');
}
else {
//alert('Error while posting.');
}
}
);
That´s intentional, the Share Dialog reads the data from the Open Graph Tags of the URL and it only takes the href as parameter, as you can see in the docs.
If you want to share custom data, you need to create a separate URL with separate Open Graph tags. After all you share a Link, and the message must be user generated anyway, so you don´t really need additional info - i guess that is why Facebook deprecated the old Feed Dialog.
thank you for your time first.
I have a very simple question here,but I can't figure it out for an entire day.
I built an facebook app which just post a message to wall,the problem is it requires user install the app first then request permission,that means 2 clicks,I don't like.
I saw somebody merged the 2 steps into 1,how did he get it?
http://www.permadi.com/tutorial/facebook-js-graph-api-post-to-wall/index2.html
And this one is mine
http://2.youpiaoma.com/fb_api/post2wall.html
Here is the snap of the install page
2.youpiaoma.com/a.JPG
The issue is that you're using the new enhanced auth dialog in your app, and for some reason it is not honoring the &perms=publish_stream parameter. Since the blog is older, some of the code is out of date with the more current ways of doing things.
I think you may benefit from using the new feed dialog instead: https://developers.facebook.com/docs/reference/dialogs/feed/
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
But if you want to continue using the old code, I would suggest the following changes:
you can use the FB.login() call instead of building the string yourself. That way the API is responsible for making the login box correct.
specify a channelUrl in your FB.init() call too. See: http://developers.facebook.com/docs/reference/javascript/FB.init/
When a user posts a comment on one of our sites, we give them the option to send the comment to their facebook wall. i.e. the following code:
FB.ui({
method: "stream.publish",
attachment: {
"name": "article title",
"href": document.location.href,
"description": "an excerpt from the article"
}
message: userComment, // The comment that the user entered on our site
user_prompt_message: shareText // "What do you think?" or similar, configurable
}, function(response){
if(response && response.post_id){
// success!
}
else{
// failed!
}
});
This popped up a dialog with the "your comment here" input pre-filled with the same comment the user posted on our site. Was totally fine via the Facebook Platform Policies, even officially encouraged at the time we initially put it into place.
But evidently they deprecated the message parameter on July 12th. So now you get a big "share" box and the content you actually want to share (the user's comment) isn't included anywhere. So, we're looking for another way to post the user's comment.
So, the latest documentation on stream.publish still says we can pass the message parameter directly via the API call, i.e.
https://api.facebook.com/method/stream.publish?callback=derp&message=EABOD+Facebook&access_token=MY_ACCESS_TOKEN&format=json
I tested it and it works, but I'm wondering if it will still work going forward, or if they just haven't shut it down yet?
If it'll replaced, i will be the feed method, which is very similar to streem method.
FB.ui(
{
method: 'feed',
link: 'http://myapp.com/myitem',
display: 'iframe',
picture: 'http://myapp.com/mylogo.jpg',
message: 'my message',
name: 'click to see item',
caption: 'title'
})
we will see next major version and see!