-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #807 from Wizcorp/develop
Update Master
- Loading branch information
Showing
109 changed files
with
4,718 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
# Troubleshooting | ||
|
||
If you cannot solve your issue here please check the **existing issues** on Github, if you still cannot find a solution please [create an issue](https://github.com/Wizcorp/phonegap-facebook-plugin/issues). | ||
|
||
When creating a Github issue **remember to**: | ||
|
||
- List your platform! | ||
- Provide sample code | ||
- Provide a log (Xcode console or adb logcat) | ||
|
||
### Troubleshooting contents | ||
- [**General**](#general) | ||
- [How do I Build without Eclipse?](#how-do-i-build-without-eclipse) | ||
- [How do I Add a Like Button?](#how-do-i-add-a-like-button) | ||
- [Where is the init API?](#where-is-the-init-api) | ||
- [How to install with NPM PhoneGap?](#how-to-install-with-npm-phonegap) | ||
|
||
- [**Android**](#android) | ||
- [No Reply From Login?](#no-reply-from-login) | ||
- [My Hash Does Not Work, I am Using Windows](#my-hash-does-not-work-i-am-using-windows) | ||
- [Jar mismatch! Fix your dependencies](#jar-mismatch-fix-your-dependencies) | ||
|
||
- [**iOS**](#ios) | ||
- [Missing FacebookConnectPlugin](#missing-facebookconnectplugin) | ||
|
||
|
||
## General | ||
### How do I Build without Eclipse? | ||
|
||
- Solution | ||
- Check the [Android Guide](https://github.com/Wizcorp/phonegap-facebook-plugin/blob/master/platforms/android/README.md) | ||
|
||
### How do I Add a Like Button? | ||
|
||
- 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](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/](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](http://stackoverflow.com/questions/11915269/built-in-like-button-facebook-sdk-3-0) | ||
Things you have to take care of are : | ||
|
||
1. Your like button must not be the same (graphically) as the Facebook like button | ||
|
||
2. 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](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). | ||
|
||
3. 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](https://graph.facebook.com/me/og.likes?access_token=FB_ACCESS_TOKEN&object=URL_TO_LIKE) | ||
|
||
4. 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](https://graph.facebook.com/LIKE_IDENTIFIER?access_token=FB_ACCESS_TOKEN). The `LIKE_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](https://developers.facebook.com/tools/explorer) tool. | ||
|
||
### Where is the init API? | ||
|
||
- Problem | ||
- I was using `FB.init()` and now it's not working. | ||
|
||
- Solution | ||
- You are using an out-dated API. Please check the [new API with sample code](https://github.com/Wizcorp/phonegap-facebook-plugin/blob/master/README.md) and sample projects in `platforms/ios` and `platforms/android`. | ||
|
||
### How to install with NPM PhoneGap? | ||
|
||
- Problem | ||
- I'm trying to install via https the Facebook plugin in iOS, but when I try the following line: | ||
|
||
`sudo phonegap local plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="12345678910" --variable APP_NAME="MyAPP"` | ||
|
||
Im getting the message "[error] Variable(s) missing: APP_ID, APP_NAME" | ||
|
||
- Solution | ||
- The `PhoneGap` CLI and `Cordova` CLI differ slightly you will need to run: | ||
|
||
`git clone https://github.com/Wizcorp/phonegap-facebook-plugin` | ||
|
||
`cd to/your/project` | ||
|
||
`phonegap local plugin add /path/to/here/phonegap-facebook-plugin --variable APP_ID="12345678910" --variable APP_NAME="AwesomeApp"` | ||
|
||
## Android | ||
### No Reply From Login? | ||
|
||
- 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) { | ||
} | ||
``` | ||
|
||
### My Hash Does Not Work, I am Using Windows | ||
|
||
- Problem | ||
- Windows users have to be careful about openssl-for-windows [http://code.google.com/p/openssl-for-windows/downloads/list](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. | ||
|
||
### Jar mismatch! Fix your dependencies | ||
|
||
- 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. | ||
|
||
## iOS | ||
### Missing FacebookConnectPlugin | ||
- Problem: | ||
- `CDVPlugin class FacebookConnectPlugin (pluginName: facebookconnectplugin) does not exist.` | ||
- Solution: | ||
1. Open up Xcode | ||
2. Go to "Build Phases" | ||
3. Ensure that the following file is added under "Compile Sources": | ||
- `FacebookConnectPlugin.m` | ||
4. 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
apply plugin: 'android-library' | ||
apply plugin: 'com.android.library' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
project.group = 'com.facebook.android' | ||
|
||
dependencies { | ||
compile 'com.android.support:support-v4:20.0.+' | ||
|
@@ -26,3 +32,100 @@ android { | |
} | ||
} | ||
} | ||
|
||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
|
||
def isSnapshot = version.endsWith('-SNAPSHOT') | ||
def ossrhUsername = hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" | ||
def ossrhPassword = hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" | ||
|
||
task setVersion { | ||
// The version will be derived from source | ||
project.version = null | ||
def sdkVersionFile = file('src/com/facebook/FacebookSdkVersion.java') | ||
sdkVersionFile.eachLine{ | ||
def matcher = (it =~ /(?:.*BUILD = \")(.*)(?:\".*)/) | ||
if (matcher.matches()) { | ||
project.version = matcher[0][1] | ||
return | ||
} | ||
} | ||
if (project.version.is('unspecified')) { | ||
throw new GradleScriptException('Version could not be found.', null) | ||
} | ||
} | ||
|
||
uploadArchives { | ||
repositories.mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
|
||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
|
||
pom.project { | ||
name 'Facebook-Android-SDK' | ||
artifactId = 'facebook-android-sdk' | ||
packaging 'aar' | ||
description 'Facebook Android SDK' | ||
url 'https://github.com/facebook/facebook-android-sdk' | ||
|
||
scm { | ||
connection 'scm:[email protected]:facebook/facebook-android-sdk.git' | ||
developerConnection 'scm:[email protected]:facebook/facebook-android-sdk.git' | ||
url 'https://github.com/facebook/facebook-android-sdk' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'https://github.com/facebook/facebook-android-sdk/blob/master/LICENSE.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'facebook' | ||
name 'Facebook' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
uploadArchives.dependsOn(setVersion) | ||
|
||
signing { | ||
required { !isSnapshot && gradle.taskGraph.hasTask("uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
task androidJavadocs(type: Javadoc) { | ||
source = android.sourceSets.main.java.srcDirs | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
} | ||
|
||
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { | ||
classifier = 'javadoc' | ||
from androidJavadocs.destinationDir | ||
} | ||
|
||
task androidSourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from android.sourceSets.main.java.sourceFiles | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
archives androidJavadocsJar | ||
} | ||
|
||
afterEvaluate { | ||
androidJavadocs.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
<target name="-post-compile"> | ||
<copy todir="bin"> | ||
<fileset dir="ant-build"/> | ||
</copy> | ||
</target> | ||
</project> |
Binary file not shown.
Binary file added
BIN
+2.91 KB
...s/android/FacebookLib/res/drawable-hdpi/com_facebook_button_like_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.91 KB
.../FacebookLib/res/drawable-hdpi/com_facebook_button_like_background_selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.89 KB
platforms/android/FacebookLib/res/drawable-hdpi/com_facebook_button_like_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.82 KB
...ndroid/FacebookLib/res/drawable-hdpi/com_facebook_button_like_icon_selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+322 Bytes
...orms/android/FacebookLib/res/drawable-hdpi/com_facebook_button_like_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.06 KB
.../android/FacebookLib/res/drawable-xhdpi/com_facebook_button_like_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.05 KB
...FacebookLib/res/drawable-xhdpi/com_facebook_button_like_background_selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.96 KB
platforms/android/FacebookLib/res/drawable-xhdpi/com_facebook_button_like_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.86 KB
...droid/FacebookLib/res/drawable-xhdpi/com_facebook_button_like_icon_selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+408 Bytes
...rms/android/FacebookLib/res/drawable-xhdpi/com_facebook_button_like_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.4 KB
...android/FacebookLib/res/drawable-xxhdpi/com_facebook_button_like_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.41 KB
...acebookLib/res/drawable-xxhdpi/com_facebook_button_like_background_selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.1 KB
...forms/android/FacebookLib/res/drawable-xxhdpi/com_facebook_button_like_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.91 KB
...roid/FacebookLib/res/drawable-xxhdpi/com_facebook_button_like_icon_selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+604 Bytes
...ms/android/FacebookLib/res/drawable-xxhdpi/com_facebook_button_like_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
platforms/android/FacebookLib/res/drawable/com_facebook_button_like.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<item | ||
android:drawable="@drawable/com_facebook_button_like_pressed" | ||
android:state_focused="true" | ||
android:state_pressed="true" | ||
/> | ||
<item | ||
android:drawable="@drawable/com_facebook_button_like_pressed" | ||
android:state_focused="false" | ||
android:state_pressed="true" | ||
/> | ||
<item | ||
android:drawable="@drawable/com_facebook_button_like_background" | ||
android:state_focused="true" | ||
android:state_pressed="false" | ||
/> | ||
<item | ||
android:drawable="@drawable/com_facebook_button_like_background" | ||
android:state_focused="false" | ||
android:state_pressed="false" | ||
/> | ||
|
||
</selector> |
Binary file added
BIN
+2.78 KB
platforms/android/FacebookLib/res/drawable/com_facebook_button_like_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.79 KB
...droid/FacebookLib/res/drawable/com_facebook_button_like_background_selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.83 KB
platforms/android/FacebookLib/res/drawable/com_facebook_button_like_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.79 KB
...rms/android/FacebookLib/res/drawable/com_facebook_button_like_icon_selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+206 Bytes
platforms/android/FacebookLib/res/drawable/com_facebook_button_like_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions
26
platforms/android/FacebookLib/res/drawable/com_facebook_button_like_selected.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<item | ||
android:drawable="@drawable/com_facebook_button_like_pressed" | ||
android:state_focused="true" | ||
android:state_pressed="true" | ||
/> | ||
<item | ||
android:drawable="@drawable/com_facebook_button_like_pressed" | ||
android:state_focused="false" | ||
android:state_pressed="true" | ||
/> | ||
<item | ||
android:drawable="@drawable/com_facebook_button_like_background_selected" | ||
android:state_focused="true" | ||
android:state_pressed="false" | ||
/> | ||
<item | ||
android:drawable="@drawable/com_facebook_button_like_background_selected" | ||
android:state_focused="false" | ||
android:state_pressed="false" | ||
/> | ||
|
||
|
||
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
platforms/android/FacebookLib/res/layout/com_facebook_login_activity_layout.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.