【问题标题】:Fabric , Digit do not return find friends listFabric , Digit 不返回查找好友列表
【发布时间】:2016-03-29 03:29:11
【问题描述】:

当我上传所有联系人并询问任何共同的朋友时,它只是返回 null。但是我有共同的朋友使用数字,如果没有朋友,它只是返回

[ ]

但现在返回 nil。 (这是下面代码的输出)

联系人总数:10,上传成功:10

好友:数字 ID:无

如何获得数字用户?我的代码有什么错误(之前成功返回了普通数字用户)

在 viewDidLoad() 中

    let digits = Digits.sharedInstance().session()
    self.uploadDigitsContacts(digits!)

然后是函数:-

 private func uploadDigitsContacts(session: DGTSession) {
    let digitsContacts = DGTContacts(userSession: session)
    digitsContacts.startContactsUploadWithCompletion { result, error in
        if result != nil {
            // The result object tells you how many of the contacts were uploaded.
            print("Total contacts: \(result.totalContacts), uploaded successfully: \(result.numberOfUploadedContacts)")
            self.findDigitsFriends(session)
        }
    }
}

private func findDigitsFriends(session: DGTSession) {
    let digitsSession = Digits.sharedInstance().session()
    let digitsContacts = DGTContacts(userSession: digitsSession)
    // looking up friends happens in batches. Pass nil as cursor to get the first batch.
    digitsContacts.lookupContactMatchesWithCursor(nil) { (matches, nextCursor, error) -> Void in
        // If nextCursor is not nil, you can continue to call lookupContactMatchesWithCursor: to retrieve even more friends.
        // Matches contain instances of DGTUser. Use DGTUser's userId to lookup users in your own database.
        print("Friends:")
        print("Digits ID: \(matches)")
        for digitsUser in matches {
            print("Digits ID: \(digitsUser.userID)")
        }
    }
}

【问题讨论】:

    标签: ios swift twitter-fabric fabric-digits


    【解决方案1】:

    找到解决办法!!!当您使用相同的模拟器通过使用不同的号码上传联系人时,会发生此错误。因此,请尝试使用以下方法从该电话号码中删除所有联系人:-

    let userSession = Digits.sharedInstance().session()
    let contacts = DGTContacts(userSession: userSession)
    contacts.deleteAllUploadedContactsWithCompletion { error in
       // Inspect error to determine if delete succeeded.
    }
    

    然后从该设备注销:-

    Digits.sharedInstance().logOut()
    

    然后再次登录Digit并再次上传联系人,并请求任何正在使用该应用程序的朋友。再次登录 digit 时不要忘记删除 deleteAllUploadedContactWithCompletion。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多