Titanium-在设备上不显示Facebook登录名 [英] Titanium - Facebook login doesn't show on device
问题描述
我正在尝试使用Titanium框架中随附的Facebook模块创建与Facebook的登录.
I'm trying to create a login with Facebook using the Facebook modules that comes in Titanium framework.
当我单击按钮时,在iphone模拟器上单击,将登录屏幕显示到Facebook.但是,当我在设备上安装时,没有得到登录屏幕-好像什么也没做(没有错误).我已发出警报,以确保单击按钮时会调用该代码位置-确实如此.
When I do a button click on the iphone emulator I get the login screen to Facebook. But when I install on the device I don't get the login screen - as if doesn't do anything (no errors). I've placed an alert to see that that place of code is called when the button clicks - it does.
这是单击按钮时的代码:
here's my code on button click:
Alloy.Globals.Facebook.permissions = ['public_profile', 'user_friends', 'email', 'user_about_me', 'user_events', 'user_hometown',
'user_likes', 'user_photos', 'user_posts', 'user_videos', 'user_tagged_places', 'user_work_history'];
Alloy.Globals.Facebook.addEventListener('login', function(e) {
// do some stuff
}
Alloy.Globals.Facebook.initialize();
Alloy.Globals.Facebook.authorize();
再次-在模拟器上运行良好,在不显示Facebook登录信息的设备上.
Again - on emulator works well, on device not showing facebook login.
推荐答案
在iOS上,您需要在tiapp.xml
中具有以下各项:
On iOS you need to have the following in tiapp.xml
:
<!-- Enable App Transport Security for Facebook -->
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
在Android上:
<application>
<activity android:label="@string/app_name"
android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
</application>
这篇关于Titanium-在设备上不显示Facebook登录名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!