1

すべての連絡先をアップロードして共通の友達を尋ねると、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)")
        }
    }
}
4

1 に答える 1

0

解決策を見つけました!!! 異なる番号を使用して連絡先をアップロードするために同じシミュレーターを使用すると、このエラーが発生します。そのため、次を使用してその電話番号からすべての連絡先を削除してみてください:-

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 を削除することを忘れないでください。

于 2016-03-29T05:40:10.463 に答える