无法在Titanium中实现Facebook登录按钮

时间:2016-08-09 07:51:58

标签: android titanium

---- index.js -------------

// create tab group
var tabGroup=Titanium.UI.createWindow({
backgroundColor:'white'
});
var fb=require('facebook');
fb.permissions=['user_profile'];

fb.forceDialogAuth=true;
var login=fb.createLoginButton({
bottom:50,style:fb.BUTTON_STYLE_WIDE
});
fb.initialize();
tabGroup.add(login);
tabGroup.open();

- tiapp.xml ---

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">

<analytics>true</analytics>
<guid>7c7ad392-1bee-43b6-9999-803f74d28278</guid>
<property name="ti.ui.defaultunit" type="string">dp</property>
<ios>
    <enable-launch-screen-storyboard>true</enable-launch-screen-storyboard>
    <plist>
        <dict>
            <key>UISupportedInterfaceOrientations~iphone</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
            </array>
            <key>UISupportedInterfaceOrientations~ipad</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
                <string>UIInterfaceOrientationPortraitUpsideDown</string>
                <string>UIInterfaceOrientationLandscapeLeft</string>
                <string>UIInterfaceOrientationLandscapeRight</string>
            </array>
            <key>UIRequiresPersistentWiFi</key>
            <false/>
            <key>UIPrerenderedIcon</key>
            <false/>
            <key>UIStatusBarHidden</key>
            <false/>
            <key>UIStatusBarStyle</key>
            <string>UIStatusBarStyleDefault</string>
        </dict>
    </plist>
</ios>
<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <application>
            <activity android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="FBApp"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" />
            <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="1594526674180785"/>
        </application>
    </manifest>
</android>
<mobileweb>
    <precache/>
    <splash>
        <enabled>true</enabled>
        <inline-css-images>true</inline-css-images>
    </splash>
    <theme>default</theme>
</mobileweb>
<modules>
    <module platform="commonjs">ti.cloud</module>
    <module platform="android">facebook</module>
    <module platform="iphone">facebook</module>
</modules>
<deployment-targets>
    <target device="android">true</target>
    <target device="ipad">false</target>
    <target device="iphone">false</target>
    <target device="mobileweb">true</target>
    <target device="windows">false</target>
</deployment-targets>
<sdk-version>5.3.1.GA</sdk-version>
<plugins>
    <plugin version="1.0">ti.alloy</plugin>
</plugins>
    <property name="ti.facebook.appid">1594526674180785</property>
<property name="appc-app-id" type="string">57a876658b3ffdfe73d9332e</property>
<property name="acs-authbase-url-development" type="string">https://secure-identity.cloud.appcelerator.com</property>
<property name="acs-base-url-development" type="string">https://api.cloud.appcelerator.com</property>
<property name="acs-oauth-secret-development" type="string">gTaoodQUd43bTwECKOxvOFby2jn5tMA6</property>
<property name="acs-oauth-key-development" type="string">QZWvZNNhpuUIL295kFsdLpv6ivXy8P8F</property>
<property name="acs-api-key-development" type="string">DW5UBw6Ry0bnh6NAe6y8lndfb5fgAuCg</property>
<property name="acs-username-development" type="string">appc_app_user_dev</property>
<property name="acs-password-development" type="string">gKWbeyNZ0R5K4ZYNbN</property>
<property name="acs-authbase-url-production" type="string">https://secure-identity.cloud.appcelerator.com</property>
<property name="acs-base-url-production" type="string">https://api.cloud.appcelerator.com</property>
<property name="acs-oauth-secret-production" type="string">aVp4q9ldVip601C6qjnEDI7Sq6PSmJ5j</property>
<property name="acs-oauth-key-production" type="string">cWeOp8cS52FHeDEXTB0WhSEDz4Sj3Jez</property>
<property name="acs-api-key-production" type="string">iqOgEsInwP0nGsyxgYepa4viv3XgmKZW</property>
<property name="acs-username-production" type="string">appc_app_user</property>
<property name="acs-password-production" type="string">8yIYbp8h3yX9i79Q8K</property>
<property name="appc-org-id" type="string">100130381</property>
<property name="appc-creator-user-id" type="string">0a5a0616-5549-4e32-b208-cb5478ff6a0c</property>

- 控制台错误------

    [ERROR] :  Surface: getSlotFromBufferLocked: unknown buffer: 0xacb87a20
    [ERROR] :  TiApplication: (AsyncTask #2) [1541,4715] Sending event:         exception on thread: AsyncTask #2 msg:java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference; Titanium 5.3.1,2016/06/09 01:34,ee11b10
    [ERROR] :  TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
    [ERROR] :  TiApplication:   at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:772)
    [ERROR] :  TiApplication:   at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:800)
   [ERROR] :  TiApplication:    at com.facebook.internal.Utility.queryAppSettings(Utility.java:822)
   [ERROR] :  TiApplication:    at com.facebook.login.widget.LoginButton$1.run(LoginButton.java:489)
   [ERROR] :  TiApplication:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
   [ERROR] :  TiApplication:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
   [ERROR] :  TiApplication:    at java.lang.Thread.run(Thread.java:818)
   [WARN] :   art: Long monitor contention event with owner method=int java.lang.String.hashCode() from String.java:620 waiters=0 for 198ms
   [INFO] :   TiRootActivity: (main) [1,1] checkpoint, on root activity resume. activity = titanium.app.social.FbappActivity@6380ff5
    [WARN] :   EGL_emulation: eglSurfaceAttrib not implemented
    [WARN] :   OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb257f180, error=EGL_SUCCESS
    [ERROR] :  Surface: getSlotFromBufferLocked: unknown buffer: 0xacb877f0
     [INFO] :   art: Background sticky concurrent mark sweep GC freed 7181(720KB) AllocSpace objects, 26(1108KB) LOS objects, 29% free, 4MB/6MB, paused 17.618ms total 3.259s
    [INFO] :   APSAnalyticsService: Stopping Analytics Service
    [INFO] :   ACS Login Results for environment `development`:
    [INFO] :   [object Object]
    [INFO] :   Process: Sending signal. PID: 3052 SIG: 9

0 个答案:

没有答案