すべての連絡先をアップロードして共通の友達を尋ねると、null が返されます。でも私には数字を使う共通の友達がいて、友達がいなければただの帰りです
[ ]
しかし、今はリターンゼロです。(以下のコードの出力は次のとおりです)
連絡先の合計: 10、正常にアップロードされた: 10
フレンズ:桁ID:なし
数字のユーザーを取得するにはどうすればよいですか? 私のコードのエラーは何ですか (以前は、これは一般的な数字のユーザーを正常に返しました)
ビューでDidLoad()
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)")
}
}
}