我有一个工作灯为基础的应用程序,使用Facebook的登录。当我preVIEW这一切都OK(我可以点击登录按钮,将显示Facebook的登录对话框中),但是当我在Android模拟器或设备上运行它,我得到LogCat中出现以下错误:
I have a Worklight-based app that uses Facebook Login. When I preview it everything is ok (I can click the login button and the Facebook Login dialog box is displayed), but when I run it on the Android Emulator or device I get the following error in LogCat:
05-28 09:17:35.391: I / Web Console (751): URL has not been configured
> to allow application.: One or more of the provided URL is not set app
> permissions. URL must match the URL of the web page or the page URL or
> domain is a subdomain of the domain of application. at
> https://www.facebook.com/connect/ping?client_id=321009794697186&response_type=token%2Csigned_request%2Ccode&domain=&origin=2&redirect_uri=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D24%23cb%3Df1eae8b44c%26origin%3Dfile%253A%252F%252F%252Ff3688c0c94%26domain%3D%26relation%3Dparent&sdk=joey:1
这是在App我的Facebook配置:
This is my Facebook configuration in the app:
window.fbAsyncInit = function() { FB.init({
appId : 'xxxxx', // App ID // channelUrl : 'http://stormy-sands-2143.herokuapp.com/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth: true });
};
// Load the SDK asynchronously (function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "http://connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js); }(document));
这是在facebook.com应用我的Facebook配置:
This is my Facebook configuration in the facebook.com app:
什么我需要配置,使之在一个设备上运行?
What do I need to configure for this to run in a device?
推荐答案
我相信,这个错误发生在你身上,因为你正在使用Facebook的JavaScript SDK。 该SDK是为在网络资源的服务器上:
I believe this error happens to you because you are using the Facebook JavaScript SDK. This SDK is meant for when the web resources are on a server:
在网站或 在移动Web应用程序Facebook应用程序需要网站或移动Web应用程序将有一个应用程序域/站点的URL,但Android应用程序没有一个域...
The Facebook App requires an App Domain/Site URL that a site or mobile web app would have, but an Android app doesn't have a domain...
一个工作灯混合应用程序的Android环境,同时利用网络资源,是不会移动网络应用,它的一个应用程序
A Worklight Hybrid app with the Android environment, while using web resources, is not a "mobile web app", it's an app.
因此,您应该使用科尔多瓦插件的实现跨平台Facebook登录(取可通过插件),或者使用的 Facebook的SDK为Android 。
Thus, you should either use a Cordova plug-in that implements Facebook login across platforms (whichever is available by the plug-in), or use the Facebook SDK for Android.
相关推荐
最新文章