react-native-google-signin / google-signin

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

NSInvalidArgumentException: Your app is missing support for the following URL schemes #1280

Closed csulit closed 1 month ago

csulit commented 1 month ago

Error after building the project locally

[CoreFoundation] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Your app is missing support for the following URL schemes:
com.googleusercontent.apps.some_id_here
*** First throw call stack:
(
0   CoreFoundation                      0x000000010da510f8 __exceptionPreprocess + 172
1   libobjc.A.dylib                     0x0000000109dabdb4 objc_exception_throw + 56
2   CoreFoundation                      0x000000010da51008 -[NSException initWithCoder:] + 0
3   listd                               0x0000000105313fc8 -[GIDSignIn signInWithOptions:] + 444
4   listd                               0x0000000105312ec8 -[GIDSignIn signInWithPresentingViewController:hint:additionalScopes:completion:] + 208
5   listd                               0x000000010539ac58 __43-[RNGoogleSignin signIn:resolver:rejecter:]_block_invoke + 372
6   libdispatch.dylib                   0x000000010d18a104 _dispatch_call_block_and_release + 24
7   libdispatch.dylib      <…>

This won't work or be registered in info.plist unless we run npx prebuild and manually include it in CFBundleURLSchemes before running run:ios.

  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>exp+listd</string>
    <string>com.googleusercontent.apps.some_id_here</string>
    </array>
  </dict> 

When included in app.json plugins and running build via expo eas, the iosUrlScheme is missing in the info.plist on the build.

  [
    "@react-native-google-signin/google-signin",
    {
      "iosUrlScheme": "com.googleusercontent.apps.some_id_here"
    }
  ]
Than-DE commented 1 month ago

I have the same issue. I hope I am misunderstanding here but it seems like being able to specifiy the iosUrlScheme in the plugin config is a sponsor-only feature that will cost you $189 for a one time payment??

https://react-native-google-signin.github.io/docs/setting-up/expo#expo-without-firebase

Edit: Nevermind, you can set this manually by adapting app.json

"ios": {
      "infoPlist": {
        "CFBundleURLTypes": [
          {
            "CFBundleURLSchemes": ["com.googleusercontent.apps.xxx"]
          }
        ]
      }
    },
vonovak commented 1 month ago

Hello and thanks for asking, troubleshooting covers this error: https://react-native-google-signin.github.io/docs/troubleshooting#on-ios-the-app-crashes-when-tapping-sign-in-button

if you use expo, use the "expo and firebase" config plugin: https://react-native-google-signin.github.io/docs/setting-up/expo#expo-and-firebase

There is also another config plugin for people who don't (want to) use firebase, as @Than-DE has mentioned. With regards to pricing: most people sponsor monthly and cancel the next month, so realistically they'd pay much less (I used to offer the module for $14). If that sounds like a lot, I invite you to try to do OSS without compensation; it's not so easy.

Thank you 🙂