SignInWithAppleButton onCompletion randomly calls

I am trying to get Sign in with Apple working for my app. I'm unable to to get onCompletion called. It randomly works when I exit Xcode or restart my Mac. Is this a known bug or maybe I am doing something wrong? I have my Sign In credentials too. Thank you for all the help!

    SignInWithAppleButton(.signIn) { request in
        withAnimation {
            isSigningIn = true
        }
        request.requestedScopes = [.fullName, .email]
        
    }  onCompletion: { result in
        print("APPLE SIGN IN")
        appleSignInHandler.onCompletion(result, showErrorSigningIn: $showSignInError) { attributes, oauthToken in
            loginHandler.commonSignIn(
                profileManager: profileManager,
                withProfileAttributes: attributes,
                oauthToken: oauthToken,
                goToHome: $goToHome,
                showInvitationSheet: $showInvitationSheet,
                showSignInError: $showSignInError
            )
        }
    }
  • After playing around with this, I found that having the withAnimation { } in the onRequest caused the issue. If I moved it to the onCompletion then everything works. If I also put it in a onTapGesture { } the same issue occurs. Hopefully that helps anyone else.

Add a Comment