Приложение сбоятся только на iOS сразу после вызова GoogleSignin.signin () из пакета @React-C-google-signin/Google-Signin. /> После проверки журнала.
Код: Выделить всё
-[GIDSignIn signInWithOptions:]
strong> App.config.js
Код: Выделить всё
I put the url scheme here for ios based on the doc of the library
plugins: [
[
"@react-native-google-signin/google-signin",
{
iosUrlScheme: "com.googleusercontent.apps.xxxxxxxx"
}
],
]
< /code>
[b] Что я попробовал: < /strong> < /p>
Включен файл GoogleService-info.plist в моем проекте. Как это: < /p>
< /li>
< /ul>
"ios": {
"infoPlist": {
"CFBundleURLTypes": [
{
"CFBundleURLSchemes": ["com.googleusercontent.apps.xxxxxxxx"]
}
]
}
}
.....
/*
|--------------------------------------------------------------------------
| Hooks
|--------------------------------------------------------------------------
*/
useEffect(() => {
GoogleSignin.configure({
webClientId: 'xxxxxxxx.apps.googleusercontent.com',
iosClientId: 'xxxxxxxx.apps.googleusercontent.com',
offlineAccess: true,
scopes: ['profile', 'email']
});
}, []);
.....
/**
* Handle Google sign in
*/
const handleGoogleSignIn = async () => {
// Set provider
setProvider('google')
try {
const currentUser = GoogleSignin.getCurrentUser();
if (currentUser) {
await GoogleSignin.signOut();
}
await GoogleSignin.hasPlayServices();
const response = await GoogleSignin.signIn(); [THE APP CRASH HERE!]
if (isSuccessResponse(response)) {
const { idToken } = response.data
const googleCredential = GoogleAuthProvider.credential(idToken); // se usi @react-native-firebase/auth
const firebaseUser = await signInWithCredential(FIREBASE_AUTH, googleCredential);
const firebaseIdToken = await firebaseUser.user.getIdToken();
setGoogleTokens({
refreshToken: (firebaseUser as any)._tokenResponse.refreshToken,
idToken: firebaseIdToken
})
handleLogin({
idToken: firebaseIdToken,
uid: firebaseUser.user.uid,
currentUser: null,
source: 'login'
});
Toast.show({
type: 'success',
text1: 'Felici di rivederti!',
text2: 'Autenticato con successo con Google.'
});
}
} catch (error) {
if (isErrorWithCode(error)) {
switch (error.code) {
case statusCodes.IN_PROGRESS:
Toast.show({
type: 'warning',
text1: 'Aspetta finché non finisce il processo di login!'
});
break;
case statusCodes.PLAY_SERVICES_NOT_AVAILABLE:
Toast.show({
type: 'error',
text1: 'Google Play Services non disponibili!'
});
break;
default:
Toast.show({
type: 'error',
text1: 'Si è verificato un errore durante il login con Google!'
});
}
} else {
Toast.show({
type: 'error',
text1: 'Si è verificato un errore durante il login con Google!'
});
}
console.error('Google sign in error:', error);
}
};
< /code>
Создал приложение с помощью EAS (EAS Build -Platform iOS) и установило его через Testflight. < /p>
Тем не менее, приложение сбои, когда GoogleSignin.Signin () вызывается на iOS.
на Android Все работает нормально! /> Expo: 52, < /li>
React-inative-google-signin /Google-signin 13.2.0, < /li>
Eas Build для iOS < /li>
no mac /no xcode < /li>
machine < /li>
< /ul>
Подробнее здесь: https://stackoverflow.com/questions/796 ... cess-linux
Мобильная версия