Yes, yet another facebook like button error. Read a dozen of threads about those errors, but it wasn't helpful.
The page: http://tanios.com/vote/
The problem is that when I click like below the picture for the first time it's OK. But when I dislike it (I press 'remove & unlike' in my news feed) and try to click like again it throws an error and suggests checking using lint. But lint doesn't show any errors. If I log out of facebook and log in again then it's the same (ok for the first, but error after unliking).
The next problem is that counter near like button says that 6 people like this. But counter above the image (data taken from http://graph.facebook.com/http%3A%2F%2Ftanios.com%2Fvote%2Findex.php%3Furl%3D1 and http://graph.facebook.com/http%3A%2F%2Ftanios.com%2Fvote%2Findex.php%3Furl%3D2 respectively) shows different number.
Is there anything I can do about this or it's something temporally wrong with facebook?
I have a simple redirection:
$is_facebook = (substr_count($_SERVER['HTTP_USER_AGENT'], "facebook") > 0);
if($_GET["url"] == 1 && !$is_facebook) header("Location: $website#lebanon");
if($_GET["url"] == 2 && !$is_facebook) header("Location: $website#montreal");
But removing this doesn't change anything.
Odd, I don't get any error when unliking from either my profile page or from your website. Here's the payload I get back for the unlike action
for
(;;);{"__ar":1,"payload":"requires_login":false,"error_info":null,
"show_error":false,"node_type":"ExternalPage",
"node_id":{theId},"edge_type":"ExternalPageLike","connect_text":0,"success":true,"already_connected":false,
"user_profile":{"name":"{myName}","profile_url":"https://www.facebook.com/{myURL}","pic_square":"{myPix"},"story_fbid":0,"is_admin":false,"admin_url":""}}
Is there something I need to try to make it break?
Related
I am having a problem getting Facebook events in the Facebook app. For example, to open an event with the url "https://www.facebook.com/events/1743847059178738/," I would use the following code:
let facebookURL = NSURL(string: "fb://event/1743847059178738")!
if UIApplication.sharedApplication().canOpenURL(facebookURL) {
UIApplication.sharedApplication().openURL(facebookURL)
} else {
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/events/1743847059178738")!)
}
}
It will open the Facebook app, but no matter what event I attempt to display I get a screen saying "Unable to load event. It may have been cancelled." I have tried substituting the Facebook URL of an event for that of a profile (e.g., string: "fb://profile/100005906912309") and it works just fine. Am I mistaken in assuming that the numbers at the end of the event's URL are the same as the event's numeric ID?
So I figured out that I could bypass the whole "fb://event..." bit and just go with:
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/events/1743847059178738")!)
I assumed this would open the link in Safari, but it automatically opened in Facebook in iOS 8.
I'm sorry for the late answer. I'd prefer to write this as comment, but I'm not able to.
First, nice work around. I think it is a perfect fallback if the fb:// scheme fails as it shown in code shared with your question. I've spent a lot of time trying to resolve the same issue. What I've found is that fb://event/{event-id} is no longer supported and it was replaced with fb://event?id={event-id}.
I've used this post as a reference.
In my application, after button click from one page context, the page actually will be rendered/loaded twice: 1) from url specified by button or form 2) page redirection from server side by HTTP 304, in this case, unless I have current thread sleep from several seconds, the element query will throw NullPointException. Here is the scenario. I am just wondering if there is anyway sleep() can be avoided, like event handler or something. I see there is onload in DocumentListener, could it possible to have unload in WindowListener or something?
try (Page page = browserEngine.navigate(LOGIN_URL)) {
element.click();
// 1. page location is login_url
// 2. page location is redirected to account overview
TimeUnit.SECONDS.sleep(3).
Document doc = page.getDocument();
doc.query("something").get();
}
The library's owner posted a solution, it works great for me:
https://github.com/ui4j/ui4j/blob/master/ui4j-sample/src/main/java/com/ui4j/sample/RedirectAndWaitExample.java
I'm following this tutorial "Facebook Login Flow for Android" (https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/) to create a simple app containing only one facebook login button to test facebook login.
However, I've been having trouble logging in facebook with this button.... I've been following every step in this tutorial and I've double checked everything -- it is exactly the same as in this tutorial. I see other people who have similar problems are always because of incorrect debug hash code. But I've checked like a million times that I got the correct debug hash code. Some people say that if you wanna release an app, you need a release code. However, I'm not releasing my app -- I'm just testing it on an android device, so I guess I dont really need a release code to do that?
Also, I've checked that I've included my facebook application id for this app in the Android Manifest. So basically, everything I did was strictly following the tutorials on Facebook Developers.
I've seen some people suggesting to use the "keytool" in JDK 6 in stead of JDK 7. And I've checked that I actually did generate my debug hash code with the "keytool" in JDK 6.
So I've tried everything, but the problem still exists!
In that Android Tutorial, it suggests putting this in your code so that you can monitor your LogCat to see if your current state is logged in or logged out:
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "Logged in...");
} else if (state.isClosed()) {
Log.i(TAG, "Logged out...");
}
}
In my case, no matter how many times I clicked Facebook Login Button, I always got "Logged out..." in my LogCat.
Also, the funny thing is, I can't even log in facebook using those sample apps coming with Facebook Android SDK 3.0.1 (eg. SessonLoginSample)!!!!! When I click the login button in those sample apps, nothing happens -- which means I'm not successfully logged in.
I really hope you guys out there can help me with this problem. It's weird I don't see other people with the exact same problem (as I said, those with similar problems are always because of incorrect debug code, but I've checked mine, it is 100% correct). THANK YOU SO MUCH!
It happened to me once. You might have added the export key hash in facebook developer setting.
Add these lines to your code to get your debugging key hash and then add to facebook.
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
I'm using the Facebook Registration Plugin (http://developers.facebook.com/docs/plugins/registration/) to register users for our site. The problem is I can't seem to get custom validation working and was wondering whether it's a mistake on my part or something wrong with Facebook.
This is the XFBML code that I'm using:
<fb:registration
fields="[{'name':'name'},
{'name':'email'},
{'name':'password','description':'Enter a password','type':'text'}]"
redirect-uri="http://local.dev"
onvalidate="validateFacebookRegistrationForm">
</fb:registration>
and I have a global function called validateFacebookRegistrationForm which has the following code in it:
function validateFacebookRegistrationForm(form) {
errors = {};
if (form.password == "") {
errors.password = "No Password Entered";
}
return errors;
}
I would expect hitting the register button on the form would do nothing and the validation message would show up... instead I get a popup like this:
http://i.imgur.com/ERxw3.jpg
Once the popup is closed, the form is validated ... and the error message shows. Clicking register again will not submit the form until the errors have been fixed - which is the how the form should behave in the first instance!
The Facebook Registration plugin does not client-side validate until AFTER the user has pressed "Register" and then in the popup pressed "Continue". Then, it will do the "client-side" validation... it really doesn't make sense to go in that order but that's how it seems to be.
Your code is fine.
I am using the latest Facebook C# SDK (v5.0.40 at time of writing) from here: http://facebooksdk.codeplex.com/.
I have created a test iFrame app in Facebook and got the CSASPNETFacebookApp sample running so that it displays the name of the currently logged in user within Facebook.
What I would now like to do is display different content in my iFrame depending on whether the user has "liked" the page. However the signed_request never seems to contain that information. From what I can see in the FacebookSignedRequest.cs I will only get the payload which contains the page information if the algorithm is AES-256-CBC HMAC-SHA256 but I only ever get HMAC-SHA256 returned.
What am I doing wrong? How do I get it to return the page information? Is it a problem with the setup of my app in Facebook or a configuration issue with the .NET app?
Thanks in advance.
var fb = new FacebookClient("access_token");
dynamic parameters = new ExpandoObject();
parameters.method = "pages.isFan";
parameters.page_id = "{you page id}";
dynamic result = fb.Get(parameters);
bool isFan = result == true;
Neil Knight's answer is technically correct, you can use FQL to look up whether a user has liked a page and it did help to set me on the right path. However my issue was actually more one of set up rather than code. What I didn't understand is that you only receive the "like" information in the signed request if your app is running within the "context of a page". If you set it up correctly then Facebook will pass your app the like flag without the user needing to "Allow" your app.
The steps are:
(1) Create your iframe application in Facebook
(2) Set up a tab url for your app in the app settings. This is what the parent page will use when it generates a link in the left hand column to go to your app.
(3) Go to your "App profile page", the URL will be something like this: http://www.facebook.com/apps/application.php?id=12345 Where 12345 is your app ID.
In the left hand column below the logo image there should be a link "Add to Page". If you click on that link you will be presented with a list of pages that you are the admin for. Select the page you want to like in your app.
Now if you navigate to your page you should get a link to your app in the left hand column. It is only when clicking on that link that you will get the page id and like status passed through to your application.
Hope this helps someone having the same issue.
You could use FQL in order to achieve this. I have just done this using the following statement:
var the_query = FB.Data.query("SELECT uid FROM page_fan WHERE page_id = {0} and uid={1}", page_id, user_id);
In order for this to work, I had to ask the user to "Allow" my application so that I had permission to check to see if they liked the page. Then, it was a simple case of checking the result and displaying the necessary <div>:
the_query.wait(function (rows) {
if (rows.length == 1 && rows[0].uid == user_id) {
$("#myLikeContent").show();
} else {
$("#myNoLikeContent").show();
}
});