具有Facebook身份验证的Native Sencha Touch应用程序

Pun*_*Raj 5 facebook sencha-touch facebook-javascript-sdk sencha-touch-2

有人在Sencha Touch中创建了原生Android/iOS应用并实施了Facebook身份验证吗?如果是这样,请分享您的代码/方法?我已经通过这个链接https://developers.facebook.com/docs...login/devices/但似乎Facebook还没有支持它.

我只想在应用程序中提供一个简单的按钮,从Facebook获取用户的Auth令牌,并将此应用程序打包为Native.

上述问题在sencha fourum中没有得到答复.我已经在这里复制了更多的观众,并且需要你的建议,因为我正在努力实现同样的目标.链接到Sencha论坛

对待Punith

Cla*_*zzi 1

我制作了一个使用 PhoneGap 构建的 Sencha Touch 应用程序,并托管在两个主要商店(Google Play 和 Apple Store)上,并具有 FB 共享功能。我使用了 PhoneGap 的“FacebookConnect”插件(https://github.com/phonegap/phonegap-plugins/tree/master/Android/FacebookConnect)。我使用以下代码来共享链接:

window.plugins.facebookConnect.dialog('feed',
  {
    link: mylink,
    picture: mypicture, // provide not a local url. otherwise, FB does not display nothing and rises an "FBCDN image is not allowed in stream" error
    name: myname,
    caption: mycaption,
    description: mydescription
  },
  function(response) {
    console.log("FacebookConnect.dialog:" + JSON.stringify(response));
  }
);
Run Code Online (Sandbox Code Playgroud)

如果尚未登录 FB(例如,使用 FB 本机应用程序(如果已安装)),该插件将在打开共享对话框之前向用户显示基于 Web 的登录窗口。

在此之前,请记住在应用程序中的某个位置使用类似的内容来初始化 FB API:

window.plugins.facebookConnect.initWithAppId(FBID, function(result) {
  console.log("FacebookConnect.initWithAppId: " + JSON.stringify(result));

  // Check for cancellation/error
  if(result.cancelled || result.error) {
    console.log("FacebookConnect.initWithAppId:failedWithError: " + result.message);
    return;
  }
});
Run Code Online (Sandbox Code Playgroud)

还要记住不要在应用程序启动时调用FB API登录方法,否则Apple将拒绝应用程序。

我希望这对您的项目有用。