I'm trying to setup Sign-in with Apple with Xcode (Beta 11.0 beta 6).
Works great on simulator, but when I run it on my iPhone (iOS 13.1), I don't get the same display.
On Simulator:
On iPhone:
This is how I call my "Sign in with Apple":
- (IBAction)signInWithApple:(id)sender {
if (@available(iOS 13.0, *)) {
ASAuthorizationAppleIDProvider *appleIDProvider = [[ASAuthorizationAppleIDProvider alloc] init];
ASAuthorizationAppleIDRequest *request = [appleIDProvider createRequest];
request.requestedScopes = @[ASAuthorizationScopeFullName,ASAuthorizationScopeEmail];
ASAuthorizationController *authorizationController = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]];
authorizationController.delegate = self;
authorizationController.presentationContextProvider = self;
[authorizationController performRequests];
} else {
// Fallback on earlier versions
}
}
Based on my debug I know that in both cases the code is executed and the email + fullname scope are set in the authorizationController.
I expect in both cases to see the Sign in with apple and to be ask about my fullname and if I wanna Hide My email...
But it only happen on simulator. On iPhone I just "continue", get my face recognize... And that's it.
In both case this is called after:
-(void)authorizationController:(ASAuthorizationController *)controller
didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0)){
ASAuthorizationAppleIDCredential *appleIDCredential = authorization.credential;
...
But in case of Simulator I'm able to get values for
"appleIDCredential.identityToken"
"appleIDCredential.email"
"appleIDCredential.fullName"
While on my iPhone I'm only able to get values for
"appleIDCredential.identityToken"
Thank you for your help ! :)
PS: In both cases I tried to connect with the same Apple Account, so I tried to look about apple configuration but I'm not sure what's wrong if it's the problem.
It seems on Simulator you see sign-up flow (first time user experience) and on the device you've already passed through sign-up and now you see log-in flow (returning user experience). I'm not sure why doesn't simulator display the log-in flow, but it works the same way for me as well.
According to documentation and this thread you won't get user info (email and full name) on completion of the log-in flow:
There is a way to return to the sign-up flow on you device by revoking usage of Apple ID by your application. To do it you can go to device Settings → Passwords & Accounts → iCloud → Password & Security → Apps Using Your Apple ID → [NameOfYourApp] App → Stop Using Apple ID → Stop Using.
You also can visit your Apple ID App Security page to do it. It should look like this:
I took the image and some hints from What the Heck is Sign In with Apple?