简体   繁体   English

Appcelerator Android Facebook登录问题

[英]Appcelerator Android Facebook Login Problems

I'm trying to let app users log into my Appcelerator app via Facebook. 我试图让应用程序用户通过Facebook登录到我的Appcelerator应用程序。 The Facebook app is in place. Facebook应用已就绪。 The correct hashes should also be in the Facebook dev system. 正确的哈希值也应该存在于Facebook开发系统中。 The iOS login works perfect. iOS登录完美。 Android however, gives this error: 但是,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: 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>

The app_id is an actual, valid, real app ID#. app_id是实际有效的真实应用程序ID#。 I have it in multiple places just to make sure the app can see it properly. 我在多个地方安装了它,只是为了确保应用程序可以正确看到它。

strings.xml: (COMPLETE FILE) 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 / Settings: 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

There is no Google play package name since it's not published yet. 由于尚未发布,因此没有Google Play包名称。 I used the App id from tiapp.xml 我使用了tiapp.xml中的App ID

Facebook Products / Facebook Login / Settings: 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 Developer Settings // Sample App Settings: 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.js:

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

index.js: 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!");
    }
}

I've tried everything I can think of to fix this. 我已经尽力解决此问题。 Any assistance would be greatly appreciated. 任何帮助将不胜感激。 Thanks. 谢谢。

Did you add the Facebook App ID to Android Resources? 您是否将Facebook App ID添加到Android资源? What is your facebook module version? 您的facebook模块版本是什么? You can try different version 您可以尝试其他版本

Hope this helps. 希望这可以帮助。

Add a string element to the /platform/android/res/values/strings.xml file with the name attribute set to facebook_app_id and the node text set to your Facebook App ID. 将字符串元素添加到/platform/android/res/values/strings.xml文件中,其名称属性设置为facebook_app_id ,节点文本设置为您的Facebook App ID。

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

Since Facebook module v4.0.0, for the Android platform, you need to: 由于Facebook模块v4.0.0,对于Android平台,您需要:

Add the Facebook Login activity to the Android manifest Add the 将Facebook登录活动添加到Android清单中

Facebook App ID to the Android resources string.xml file Create a 将Facebook App ID转到Android资源的string.xml文件,创建一个

Facebook proxy and associate it with the currently active activity Facebook代理并将其与当前活动关联

Seems you did not complete additional android setup steps. 似乎您尚未完成其他android设置步骤。 For details please take a look on documents: http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook 有关详细信息,请查看文档: http : //docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM