在IOS中,本地Apple登录卡在“输入密码”屏幕中?

在IOS中,本地Apple登录卡在“输入密码”屏幕中?,ios,react-native,sign-in-with-apple,apple-login,Ios,React Native,Sign In With Apple,Apple Login,在IOS中,输入密码后显示加载,之后什么也没有发生。没有控制台日志?在android中工作正常 我已经实现了react原生apple身份验证的V2 尝试了同一问题下的2个代码 代码1 const IOSAppleLogin = async () => { try { // performs login request const appleAuthRequestResponse = await appleAuth.pe

在IOS中,输入密码后显示加载,之后什么也没有发生。没有控制台日志?在android中工作正常

我已经实现了react原生apple身份验证的V2

尝试了同一问题下的2个代码

代码1

  const IOSAppleLogin = async () => {
        try {
            // performs login request
            const appleAuthRequestResponse = await appleAuth.performRequest({
                requestedOperation: appleAuth.Operation.LOGIN,
                requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME]
            });
    
            const credentialState = await appleAuth.getCredentialStateForUser(
                appleAuthRequestResponse.user
            );
    

            if (credentialState === appleAuth.State.AUTHORIZED) {

            console.log('appleAuthRequestResponse', appleAuthRequestResponse);
           
            const response = appleAuthRequestResponse;
            console.log('apple-response', response);
            // you may also want to send the device's ID to your server to link a device with the account
            // identityToken generated


            if (response) {
                if (response.identityToken) {
                    let device_identifier = DeviceInfo.getUniqueId();
                    let details = {
                        'identity_token': response.identityToken,
                        'first_name': response.fullName ? response.fullName.givenName : '-',
                        'last_name': response.fullName ? response.fullName.familyName : '-',
                        'device_identifier': device_identifier,
                        device: Platform.OS
                    };
                    props.appleLogin({ values: details });
                }
            }
            // user is authenticated
            }

        } catch (error) {
            if (appleAuth.Error.CANCELED === error.code) {
                console.log('apple-error-CANCELED', JSON.stringify(error));
            } else if (appleAuth.Error.FAILED === error.code) {
                console.log('apple-error-FAILED', error);
            } else if (appleAuth.Error.NOT_HANDLED === error.code) {
                console.log('apple-error-NOT_HANDLED', error);
            } else {
                console.log('apple-error', error);
            }
        }
    }
代码2

  const IOSAppleLogin = async () => {
        try {
            // performs login request
            const appleAuthRequestResponse = await appleAuth.performRequest({
                requestedOperation: appleAuth.Operation.LOGIN,
                requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME]
            });
    

            console.log('appleAuthRequestResponse', appleAuthRequestResponse);
           
            const response = appleAuthRequestResponse;
            console.log('apple-response', response);
            // you may also want to send the device's ID to your server to link a device with the account
            // identityToken generated


            if (response) {
                if (response.identityToken) {
                    let device_identifier = DeviceInfo.getUniqueId();
                    let details = {
                        'identity_token': response.identityToken,
                        'first_name': response.fullName ? response.fullName.givenName : '-',
                        'last_name': response.fullName ? response.fullName.familyName : '-',
                        'device_identifier': device_identifier,
                        device: Platform.OS
                    };
                    props.appleLogin({ values: details });
                }
            }
            // user is authenticated

        } catch (error) {
            if (appleAuth.Error.CANCELED === error.code) {
                console.log('apple-error-CANCELED', JSON.stringify(error));
            } else if (appleAuth.Error.FAILED === error.code) {
                console.log('apple-error-FAILED', error);
            } else if (appleAuth.Error.NOT_HANDLED === error.code) {
                console.log('apple-error-NOT_HANDLED', error);
            } else {
                console.log('apple-error', error);
            }
        }
    }

这也发生在我身上。在这里找到了解决方案


基本上,如果你在模拟器上使用iOS 13,或者在真实设备上使用iOS 14。当我试图在模拟器上运行代码时,我也会遇到这种情况,在真实设备上尝试一下,它会工作的。 不要忘了在签名和功能中为发布和调试应用程序添加登录Apple。为此,您应该有一个ADP帐户

多谢各位