Can't solve your issue here? Check the existing issues on Github. If you still cannot find a solution please create and issue after reading the contributing guide.
When creating a Github issue remember to:
- List your platform!
- Provide sample code
- Provide a log (Xcode console or adb logcat)
- Solution
- Check the Android Guide
-
Problem
- I am trying to implement like button functionality in my app. Whenever user likes my facebook page, user will get rewards. So i have tried to implement this like button functionality as described here: https://developers.facebook.com/docs/plugins/like-button
-
Solution
- It won't work for native apps because: https://developers.facebook.com/docs/ios/like-button/ is not supported yet. HOWEVER; it can be done with the graph API http://stackoverflow.com/questions/11915269/built-in-like-button-facebook-sdk-3-0 Things you have to take care of are :
-
Your like button must not be the same (graphically) as the Facebook like button
-
When you display your page / button you have to call the getLoginStatus method first to know if the current user is connected to its Facebook account. If he is connected then call
GET
https://graph.facebook.com/me/og.likes?access_token=FB_ACCESS_TOKEN&object=URL_TO_LIKE with the Facebook Access Token returned by the g3. etAccessToken method (if this returns data then style your like button with a red heart for example, a grey heart if the call returns an empty array). -
To create a like (when your user clicks on your like button and your like button is a grey heart) do a POST on https://graph.facebook.com/me/og.likes?access_token=FB_ACCESS_TOKEN&object=URL_TO_LIKE
-
To remove a like (when your user clicks on your like button and your like button is a red heart) do a
DELETE
on https://graph.facebook.com/LIKE_IDENTIFIER?access_token=FB_ACCESS_TOKEN. TheLIKE_IDENTIFIER
is returned from steps 2 or 3.
The better way to understand this little "workflow" is to manipulate the Graph API on the og.likes endpoint using the Facebook Graph Explorer tool.
-
Problem
- I was using
FB.init()
and now it's not working.
- I was using
-
Solution
- You are using an out-dated API. Please check the new API with sample code and sample projects in
platforms/ios
andplatforms/android
.
- You are using an out-dated API. Please check the new API with sample code and sample projects in
-
Problem
- facebookConnectPlugin.login doesn't call neither success nor faillure methods. - When I'm disconnected from Facebook and don't have the native app, the iframe fallback is blank. Checking on chrome inspector, the elements are set to display: none.
-
Solution
- Copy and paste the following code to print your hash. Add the hash to your Facebook Developer Dashboard.
try {
PackageInfo info =
cordova.getActivity().getPackageManager().getPackageInfo("com.goapes.golearn", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.e("MY KEY HASH:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
-
Problem
- Receiving the above error and no return from login.
-
Solution
- Your hash is wrong or not updated see No Reply From Login?
-
Problem
- Windows users have to be careful about openssl-for-windows http://code.google.com/p/openssl-for-windows/downloads/list, the latest version, at least on plataform 64bit, does not generate the correct hash that Facebook needs for android apps.
-
Solution
- Use one of these versions when creating your hash: openssl-0.9.8e_X64.zip or openssl-0.9.8d_X64.rar
You should not use the openssl-0.9.8k_X64.zip.
- Problem
- I get this error:
BUILD FAILED
/usr/local/opt/android-sdk/tools/ant/build.xml:577: Jar mismatch! Fix your dependencies
- Solution
- You may have duplicate android-support-v4.jar files. Remove android-support-v4.jar from the
/libs
folder of your project.
- You may have duplicate android-support-v4.jar files. Remove android-support-v4.jar from the
-
Problem:
- In landscape orientation the dialog is too small to use keyboard input
-
Solution:
- One can force the dialog to be displayed fullscreen, providing additional screen space for the dialog
Add this import to facebookConnectPlugin.java
import android.content.res.Configuration;
Change the feed dialog from:
WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback).build();
feedDialog.show();
to
WebDialog.FeedDialogBuilder feedDialog = (new WebDialog.FeedDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback);
if (cordova.getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
feedDialog.setTheme(android.R.style.Theme_Wallpaper_NoTitleBar_Fullscreen);
}
feedDialog.build().show();
Change the feed dialog from:
WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback)
.build();
requestsDialog.show();
to
WebDialog.RequestsDialogBuilder requestsDialog = (new WebDialog.RequestsDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback);
if (cordova.getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
requestsDialog.setTheme(android.R.style.Theme_Wallpaper_NoTitleBar_Fullscreen);
}
requestsDialog.build().show();
- Problem:
CDVPlugin class FacebookConnectPlugin (pluginName: facebookconnectplugin) does not exist.
- Solution:
- Open up Xcode
- Go to "Build Phases"
- Ensure that the following file is added under "Compile Sources":
FacebookConnectPlugin.m
- Ensure that the following is added under "Link Binary With Libraris":
FacebookSDK.framework
libsqlite3.dylib
Social.framework
Accounts.framework
Security.framework
Cordova and plugman seems to have some problems adding frameworks etc. when re-installing/upgrading plugins.
- Problem:
- Calling the login function always opens the web dialog even though the native app is installed on the device.
- Solution:
- Switch "deep linking" to ON in the Facebook developer website settings for your application
- problem:
- even if login works properly with older iOS versions, on iOS 10+, error callback is always called
- Solution:
- Give the iOS application access to the Keychain Sharing capability before building it as instructed in http://stackoverflow.com/questions/38689631/how-to-use-facebook-ios-sdk-on-ios-10.