用JavaScript复制parse.com anypic-无法比较Fb用户 [英] Replicating parse.com anypic in JavaScript - Unable to compare Fb users

查看:78
本文介绍了用JavaScript复制parse.com anypic-无法比较Fb用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用parse.com构建我的应用程序的后端.我希望用户能够找到正在使用我的应用程序的朋友以及在Facebook上与谁成为朋友.

I'm using parse.com to build the back end of my app. I want the user to be able to find their friends that are using my app and who they are friends with on Facebook.

我使用的是JavaScript,但是与IOS不同,这里 https://www.parse.com /tutorials/anypic#follow 没有有关如何构建应用的示例

I'm using JavaScript, however unlike IOS, here https://www.parse.com/tutorials/anypic#follow there are no examples on how to build the app

我已经使用Fb SDK撤回了用户的朋友连接,但是我对下一步的工作感到困惑.

I have used the Fb SDK to pull back a users friend connections, but I'm stumped on how to proceed next.

我想我需要在返回的数据和我当前的用户数据之间运行查询,寻找匹配项,然后将其返回?

I guess I need to run a query between the returned data and my current users data and look for matches and then return them?

有人有这样做的经验吗?可以共享一些代码或将我指向外部资源的方向?

Has any one experience doing this? can share some code or point me in the direction of external resources?

FB.getLoginStatus(function (response) {
  if (response.status === 'connected') {
    FB.api('/me/friends', function(response){
      if (response && response.data){
            for (var friendIndex=0; friendIndex<data.length; friendIndex++)

      } else {
        console.log('Something goes wrong', response);
      }
    });

  }
});

推荐答案

可靠地执行此操作的唯一方法(与语言无关)是一个多步骤过程:

The only way to do this reliably, which has nothing to do with language, is a multi-step process:

一个:提供一种连接到Facebook"的方法.在此过程中,您提取用户的facebook id并将其存储为解析中用户配置文件中的字段.这是您需要与朋友配对的领域.

One: Provide a way to "connect to facebook". In this process, you pull the user's facebook id and store it as a field on the user profile in parse. This is the field you need to match friends.

您将只能可靠地将已经将其应用程序连接到脸书的用户朋友(并因此将他们的Facebook ID存储在他们的用户个人资料中)

You will only be able to reliably match the user's friends who has ALSO CONNECTED THEIR APP TO FACEBOOK (and thereby stored their facebook id in their user profile).

两个:使用用户朋友的Facebook ID对Parse进行查询.对于您在Parse用户数据库中找到的每个好友facebook id,您都可以从FACEBOOK中显示其姓名等(以便他们轻松识别).

Two: Perform a query against Parse with the user's friends' facebook IDs. For every friend facebook id you find in your Parse user database, you display their name etc FROM FACEBOOK (so they recognize them easily).

这意味着当您添加此功能时,没有人会在他们的应用程序中从facebook找到他们的朋友.只有当他们的一些朋友连接到Facebook时,他们才能找到这样的Facebook朋友.

This means that when you add this functionality, nobody will find their friends from facebook in their app. Only when some of their friends connect to facebook will they be able to find facebook friends like this.

您可以在应用启动时进行检查,然后通知用户他们的某些Facebook朋友现在正在使用您的应用.

You can i.e. check for this on app launch, and then notify the user that some of their facebook friends are now using your app.

这篇关于用JavaScript复制parse.com anypic-无法比较Fb用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆