0

Currently I do:

    if #available(iOS 10.0, *) {

        CKContainer.default().discoverUserIdentity(withEmailAddress: "barteks****@icloud.com") { identity, error in

            print(error?.localizedDescription)
            print(identity)
        }
    }

the result is:

nil
nil

I am pretty sure that following address exists, because it is mine. Why it prints nil?

I follow this tutorial and got stuck with Look up via phone chapter.

What do I try to do?

I would like to share some records with other user. But first I need to somehow determine that user. Is it correct?

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
  • Maybe you checked yet but... Is your device/simulator logged on iCloud? – Adolfo Mar 06 '17 at 15:22
  • Because Apple broke this in the iOS 10.3 release. See my post here: http://stackoverflow.com/questions/43130466/discoverallidentities-discoveruseridentity-returning-nil-for-ckuseridentity-lo – Wizkid Apr 07 '17 at 20:26

1 Answers1

1

Request permission first:

[[CKContainer defaultContainer] requestApplicationPermission:CKApplicationPermissionUserDiscoverability
             completionHandler:^(CKApplicationPermissionStatus applicationPermissionStatus, NSError *error) {
                       // check(applicationPermissionStatus == CKApplicationPermissionStatusGranted)
             });}

How to grant discoverUserInfoWithUserRecordID permission?

AntScript
  • 513
  • 5
  • 6