ios – Is there a option to talk with consumer if they’ve used their Apple ID as telephone quantity

0
33


In My app I’m utilizing Signal In with Apple possibility. Right here I face a difficulty with customers who accomplished enroll Apple ID with telephone quantity. I wished to ship a notification to consumer relating to the occasions which is upcoming which is out there on again finish.

Right here is my code how I do authentication

    let supplier = ASAuthorizationAppleIDProvider()
    let request = supplier.createRequest()
    request.requestedScopes = [.email, .fullName]
    let controller = ASAuthorizationController(authorizationRequests: [request])
    controller.delegate = self
    controller.presentationContextProvider = self
    controller.performRequests()

and the deligate to seize the small print

func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
    swap authorization.credential {
    case let credentials as ASAuthorizationAppleIDCredential:
        let userIdentifier = credentials.consumer
        var firstName = credentials.fullName?.givenName
        if (firstName?.rely == 0) {
            firstName = KeychainItem.currentUserFirstName
        }
        var lastName = credentials.fullName?.familyName
        if (lastName?.rely == 0) {
            lastName = KeychainItem.currentUserLastName
        }
        var electronic mail = credentials.electronic mail
        if (electronic mail?.rely == 0) {
            electronic mail = KeychainItem.currentUserEmail
        }
        self.saveEmailInKeychain(electronic mail ?? "")
        self.saveFirstNameInKeychain(firstName ?? "")
        self.saveLastNameInKeychain(lastName ?? "")
        self.saveUserInKeychain(userIdentifier)
        var param: [String: Any] = ["social_login_id" : userIdentifier, "provider":"apple"]
        if (firstName?.rely ?? 0 > 0) {
            param.updateValue(firstName ?? "", forKey: "first_name")
        }
        if (lastName?.rely ?? 0 > 0) {
            param.updateValue(lastName ?? "", forKey: "last_name")
        }
        if (electronic mail?.rely ?? 0 > 0) {
            param.updateValue(electronic mail ?? "", forKey: "electronic mail")
        }
        appleSignInParam = param
        break
    default:
        break
    }
}

non-public func saveUserInKeychain(_ userIdentifier: String) {
    do {
        attempt KeychainItem(service: "com.progton.smashers", account: "userIdentifier").saveItem(userIdentifier)
    } catch {
        print("Unable to save lots of userIdentifier to keychain.")
    }
}

The issue I face right here is that if consumer have created Apple ID with telephone quantity I’ve not contact with the consumer. Is there a option to talk with consumer if they’ve used their Apple ID as telephone quantity.

Thanks prematurely