簡體   English   中英

Appcelerator Android Facebook登錄問題

[英]Appcelerator Android Facebook Login Problems

我試圖讓應用程序用戶通過Facebook登錄到我的Appcelerator應用程序。 Facebook應用已就緒。 正確的哈希值也應該存在於Facebook開發系統中。 iOS登錄完美。 但是,Android會出現此錯誤:

[DEBUG] :  TiFacebookModule: (KrollRuntimeThread) [7865,569655] authorize called, permissions length: 1
[DEBUG] :  TiFacebookModule: (KrollRuntimeThread) [0,569655] authorizing permission: email
[DEBUG] :  ActivityWorkerProxy: (main) [232,569887] ActivityWorkerProxy onActivityResult
[ERROR] :  TiFacebookModule: (main) [1,569888] FacebookCallback error: Login attempt failed.
[ERROR] :  E/        : UID 10070 asks for /proc/cpuinfo
[ERROR] :  E/        : Unable to open file /data/data/.appwithABI2
[ERROR] :  E/        : Unable to open file /data/data/.appwithABI2neon
[ERROR] :  E/        : UID 10070 is not in ARM UID list files

tiapp.xml:

## SDK: 6.0.1GA
## facebook module included (android 6.2.0)

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <uses-permission android:name="android.permission.INTERNET"/>
        <application>
            <activity android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="myNewApp"
            android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
            <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
            <activity android:name="com.mynewapp.android" />
            <resources>
                <string name="facebook_app_id">[actual_FB_ID#]</string>
            </resources>
        </application>
        <resources>
            <string name="facebook_app_id">[actual_FB_ID#]</string>
        </resources>
    </manifest>
    <resources>
        <string name="facebook_app_id">[actual_FB_ID#]</string>
    </resources>
</android>

app_id是實際有效的真實應用程序ID#。 我在多個地方安裝了它,只是為了確保應用程序可以正確看到它。

strings.xml :( 完整文件)

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <string name="app_name" formatted="false">[Tried both the Facebook "Display Name" & the "Namespace"]</string>
    <string name="facebook_app_id">[actual_FB_ID#]</string>
</resources>

Facebook APP /設置:

App ID: [actual_FB_ID#]
App Secret: ******
Display Name: A Display Name
Namespace: anamespace
App Domains: [EMPTY]
Privacy: [EMPTY]
Terms: [EMPTY]
Category: Health & Fitness

// ANDROID
Google Play Package Name: [see below]
Class Name: [package name above + .index]
Key Hashes: [4: 6.0.0.GA, 6.0.1.GA, 6.0.2.GA, and 6.0.3.GA] 
Amazon App Store: [EMPTY]
Single Sign On: No

由於尚未發布,因此沒有Google Play包名稱。 我使用了tiapp.xml中的App ID

Facebook產品/ Facebook登錄/設置:

Client OAuth Login: Yes
Web OAuth Login: Yes
Force Web OAuth Reauthentication: No
Embedded Browser OAuth Login: No
Valid Redirects: [EMPTY]
Login From Devices: Yes

Facebook開發人員設置//示例應用程序設置:

Entering key hashes here doesn't save. I enter the same hashes as in the android settings above, hit "Save Changes", and they just disappear.

alloy.js:

Alloy.Globals.Facebook = require('facebook');
var fb = require('facebook');

index.js:

$.index.fbProxy = fb.createActivityWorker({
    lifecycleContainer: $.index
});

fb.initialize();
fb.setLoginBehavior(fb.LOGIN_BEHAVIOR_NATIVE);
fb.permissions = ['email'];
fb.addEventListener('login', doFBlogin);

function facebookButtonClick(e){
    fb.authorize();
}

function doFBlogin(e) {
    if (e.success) {
        alert("Success!");
    } else if (e.cancelled) {
        alert("Cancelled!");
    } else {
        alert("Error!");
    }
}

我已經盡力解決此問題。 任何幫助將不勝感激。 謝謝。

您是否將Facebook App ID添加到Android資源? 您的facebook模塊版本是什么? 您可以嘗試其他版本

希望這可以幫助。

將字符串元素添加到/platform/android/res/values/strings.xml文件中,其名稱屬性設置為facebook_app_id ,節點文本設置為您的Facebook App ID。

<resources>
    <string name="facebook_app_id">FACEBOOK_APP_ID</string>
</resources>

由於Facebook模塊v4.0.0,對於Android平台,您需要:

將Facebook登錄活動添加到Android清單中

將Facebook App ID轉到Android資源的string.xml文件,創建一個

Facebook代理並將其與當前活動關聯

似乎您尚未完成其他android設置步驟。 有關詳細信息,請查看文檔: http : //docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM