react-native-google-signin / google-signin

Google Sign-in for your React Native applications
https://react-native-google-signin.github.io/
MIT License
3.19k stars 879 forks source link

App crashing on iOS while tapping on Sign in with Google! #1243

Closed mohdabbas closed 7 months ago

mohdabbas commented 7 months ago

The app is getting crashed while tapping on Signin with Google on iOS. On Android it is working fine. My app is managed by expo so I cannot use xcode. I am not using the sponsored version.

app.json

"plugins": [ "expo-apple-authentication", [ "@react-native-google-signin/google-signin", { "iosUrlScheme": "com.googleusercontent.apps.xxx-xxx" } ] ], "ios:{ "bundleIdentifier": "myapp", "infoPList": { "CFBundleURLTypes": [{"CFBundleURLSchemes":["com.googleusercontent.apps.xxx-xxx"]}], "UIRequiresFullScreen": true, .....

GoogleLogin.js

const SignIn = async () => { try { GoogleSignin.configure({ webClientId: "xxx-xxx.apps.googleusercontent.com", androidClientId: "xxx-xxx.googleusercontent.com", iosClientId: "xxx-xxx.apps.googleusercontent.com", }) // GoogleSignin.configure({ // scopes: [ // "https://www.googleapis.com/auth/userinfo.profile", // ], // webClientId: Platform.OS === 'android' ? 'xxx-xxx.apps.googleusercontent.com' : 'xxx-xxx.apps.googleusercontent.com', // iosClientId: Platform.OS === 'ios' ? 'xxx-xxx.apps.googleusercontent.com' : undefined, // offlineAccess: false, // }); await GoogleSignin.hasPlayServices(); const userInfo = await GoogleSignin.signIn();

I am unable to get any userInfo, instead the app crashes. Unable to get any logs!

I am using:

"expo": "~49.0.6", "react-native": "0.72.6", "@react-native-google-signin/google-signin": "^11.0.0"

Thanks in advance for any suggestion/help.

gunnartorfis commented 7 months ago

Since you're using Expo SDK <= 50, have you made sure you've followed the compatibility guide? https://react-native-google-signin.github.io/docs/setting-up/expo#ensure-compatibility

mohdabbas commented 7 months ago

The compatibility guide says: If you're using the sponsor package: If you're using Expo SDK >= 50, you're good to go. But if you're using Expo 49 or older, you need to either: install version 12.1.0 of the package or install version >= 13 AND specify compileSdkVersion 34 of your project using Expo BuildProperties

I am not using the sponsor package. The latest version available here is 11.

gunnartorfis commented 7 months ago

@mohdabbas I'd recommend prebuilding, opening the app in Xcode and check the logs that appear there when the app crashes.

vonovak commented 7 months ago

I second what was said in the comment above.

Please note that the package does not work with Expo go, as documented. Please follow the set up guide very carefully and you'll make it work Thank you 🙂