4

I am following the instructions listed at http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook

And looking at the examples in the example directory for Arrow /Users//Library/Application Support/Titanium/modules/commonjs/ti.cloud/3.2.10/example/windows/social/externalLogin.js

I have my Tiapp.xml configured like the instructions show

<ios>
        <plist>
            <dict>
                <key>CFBundleURLTypes</key>
                <array>
                    <dict>
                        <key>CFBundleURLName</key>
                        <string>my.org</string>
                        <!-- Application ID same as the id value in the tiapp.xml file -->
                        <string>my.application.id</string>
                        <key>CFBundleURLSchemes</key>
                        <array>
                            <!-- Prefix the Facebook App ID with 'fb' -->
                            <string>my.org</string>
                            <string>fb(my.facebook.app.id)</string>
                        </array>
                    </dict>
                </array>
                <key>FacebookAppID</key>
                <!-- Facebook App ID -->
                <string>(my.facebook.app.id)</string>
                <key>FacebookDisplayName</key>
                <!-- Facebook App Name from developer.facebook.com -->
                <string>my.org</string>
                <key>LSApplicationQueriesSchemes</key>
                <array>
                    <string>fbapi</string>
                    <string>fb-messenger-api</string>
                    <string>fbauth2</string>
                    <string>fbshareextension</string>
                </array>

            </dict>
        </plist>
    </ios>
    <modules>
        <module platform="iphone">ti.map</module>
        <module platform="iphone">facebook</module>
        <module platform="commonjs">ti.cloud</module>
    </modules>
    <deployment-targets>
        <target device="iphone">true</target>
    </deployment-targets>
    <sdk-version>5.2.0.GA</sdk-version> 

my alloy view file looks like

<Alloy>
    <!-- UI Layout for Eventful page -->
    <Window id="social" class="container" navBarHidden="false" size="Ti.UI.FILL" title="" navTintColor="white"  backButtonTitle="Event" barColor="black" onOpen="login">
        <View backgroundColor="black" >
            <LoginButton id="fbLogin" module="facebook" top="1%" height="7%" permissions="user_events"/>
        </View>
    </Window>
</Alloy>

my controller .js file looks like

var fb = require('facebook');
fb.readPermissions = ['read_stream','email','user_events'];
fb.appid = (my.facebook.app.id);
fb.forceDialogAuth = true;

function login (evt) {

    fb.addEventListener('login', function(e) {
    if (e.success) {
        alert('Logged in');
    }
    });

    fb.addEventListener('logout', function(e) {
        alert('Logged out');
    });

};

我按预期获得了 Facebook 登录按钮但是当我单击它时,我只是收到一条错误消息: 未登录:您尚未登录。请登录并重试。

我从来没有看到输入用户名和密码的屏幕 FB 登录按钮错误

环境是 Appcelerator Studio,构建:4.5.0 Titanium SDK 5.2.0.GA iPhone 6 Sim / Hardware with iOS 9.2

4

1 回答 1

0

我遇到了同样的问题,并解决了在设备中安装完整的 Facebook 应用程序的问题。

于 2017-07-13T16:01:16.800 回答