Four
Four

Reputation: 506

CloudKit Discovery discoverAllContactUserInfosWithCompletionHandler returns empty

Here's the goal:

  1. User A and User B are users of the app.
  2. They are using separate devices logged into separate iCloud accounts.
  3. Both users enable discoverability in the app.
  4. Once enabled, User A can see that User B is using the app, and vice versa (assuming both have each other's iCloud emails in their contact books).

Currently, I've followed through the following steps, but discoverAllContactUserInfosWithCompletionHandler returns empty. I'm stumped. I've:

  1. Configured the app for CloudKit
  2. Am checking the status with accountStatusWithCompletionHandler. I am receiving accountStatus == .Available
  3. Check discovery permission with statusForApplicationPermission(CKApplicationPermissions.PermissionUserDiscoverability). I am receiving permissionStatus == .Granted
  4. I now request app users using discoverAllContactUserInfosWithCompletionHandler. In the completion block, I receive no error and an empty users array. I've also tried using discoverUserInfoWithEmailAddress to pull a user that I've registered with on a separate device. This returns a nil user object, but no error.

I'm not sure what I'm missing here. Any advice/troubleshooting tips would be much appreciated.

Upvotes: 0

Views: 753

Answers (1)

Yariv Nissim
Yariv Nissim

Reputation: 13343

Check out this answer - CKDiscoverAllContactsOperation not fetching contacts

The other users must enable Discoverability on their iCloud account with your app AND use the same email address as stored in your Contacts.

Upvotes: 0

Related Questions