简体   繁体   中英

What if application delete and then reinstalled how i can get the email address and name Sign in With Apple

Recently my app rejected from apple with the issue that must include the sign in with apple and than i tried that now i am encountered one of the use case and cant find the solution so far.

What if user sign in with the apple in my app and get email address to get register on my server but what happened if he delete the app and than reinstall the app after some time now he will not get the email address as per apple documentation

if ([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) {
    // ASAuthorizationAppleIDCredential
    ASAuthorizationAppleIDCredential *appleIDCredential = authorization.credential;
    NSString *user = appleIDCredential.user;
    [[NSUserDefaults standardUserDefaults] setValue:user forKey:setCurrentIdentifier];
    [mStr appendString:user?:@""];
    NSString *familyName = appleIDCredential.fullName.familyName;
    [mStr appendString:familyName?:@""];
    NSString *givenName = appleIDCredential.fullName.givenName;
    [mStr appendString:givenName?:@""];
    NSString *email = appleIDCredential.email;
    [mStr appendString:email?:@""];
    NSLog(@"mStr:%@", mStr);
    [mStr appendString:@"\n"];
    appleIDLoginInfoTextView.text = mStr;

} 

once i get successfully registered and get email address i will not get the email and for second time even if i delete the app.

You don't always get the email except first time. But every time you login, you will be getting a unique identifier which you can use to retrieve email and other details.

Either save these details in your database hosted on server or save/retrieve them from keychain. Items saved in Keychain don't get removed on app uninstall. So you can easily retrieve these details from Keychain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM