仅从 Facebook 获取新朋友 iOS

Get only new friends from Facebook iOS

我们的应用程序使用 Firebase。对于应用程序中的身份验证,我们使用 Facebook。在 Facebook SDK 的帮助下,我得到了用户的好友 问题是,我只能请求 "new friends" 吗?比如我请求了10月25日的所有好友列表,为了下次不再请求用户的所有好友列表,我从需要用户好友信息的时候开始发送时间戳参数。我阅读了很多帖子并搜索了信息,但没有找到对我的情况有用的信息。谢谢。

func getFriends() {
    DispatchQueue.global(qos: .background).async {
        let params = ["fields": "id, first_name, last_name, name, email, picture"]
        let graphRequest = FBSDKGraphRequest(graphPath: "/me/friends", parameters: params)
        let connection = FBSDKGraphRequestConnection()
        connection.add(graphRequest, completionHandler: { (connection, result, error) in
            if error == nil {
                guard let userData = result as? [String : Any] else { return }
                guard let jsonData = userData["data"] as? [[String : Any]] else { return }
                debugPrint("facebook data", jsonData)
                do {
                    let data = try JSONSerialization.data(withJSONObject: jsonData, options: JSONSerialization.WritingOptions.prettyPrinted)
                    let jsonDecoder = JSONDecoder()
                    let friends = try jsonDecoder.decode(Array<FacebookFriendModel>.self, from: data)
                    debugPrint("friends", friends.count)
                    self.saveFriends(friends)
                } catch {
                    debugPrint(error.localizedDescription)
                }
            } else {
                print("Error Getting Friends \(error?.localizedDescription ?? "")");
            }
        })

        connection.start()
    }
}

The question is, can I only ask for "new friends"? For example, I requested a list of all friends on October 25, and to not ask the list of all friends of the user to be next time, I send timestamp parameters from when I need information about user's friends.

不,那种功能根本不可用。

当 两个用户成为好友时,Facebook 故意不提供 信息。