简体   繁体   English

在 iOS 中反应原生谷歌登录失败

[英]react native google signin failed in iOS react native

I run the react-native upgrade to fix the play store base 64 issue.我运行 react-native 升级来修复 play store base 64 问题。 Android is working fine the only issue I am facing with iOS. Android 工作正常,这是我在使用 iOS 时遇到的唯一问题。 React native google sing in failed when run for the build.为构建运行时,React Native google sing in 失败。

I have run the following commands:我已经运行了以下命令:

  • react-native-upgrade@0.59.1反应原生升级@0.59.1

  • rm -rf node_modules && npm i rm -rf node_modules && npm i

  • Upgrade the google sdk 4.4.0 to 5.0.0 and将谷歌 sdk 4.4.0 升级到 5.0.0 和

  • cd ios && pod install && cd.. cd ios && 吊舱安装 && cd..

Here are errors:以下是错误:

1) No visible @interface for 'GIDSignIn' declares the selector 'signInSilently' 1) 'GIDSignIn' 没有可见的@interface 声明选择器'signInSilently'

[[GIDSignIn sharedInstance] signInSilently];

2) No visible @interface for 'GIDSignIn' declares the selector 'hasAuthInKeychain' 2) 'GIDSignIn' 没有可见的@interface 声明选择器'hasAuthInKeychain'

RCT_REMAP_METHOD(isSignedIn,
                 resolver:(RCTPromiseResolveBlock)resolve
                 rejecter:(RCTPromiseRejectBlock)reject)
{
  BOOL isSignedIn = [[GIDSignIn sharedInstance] hasAuthInKeychain];
  resolve([NSNumber numberWithBool:isSignedIn]);
}

3) No visible @interface for 'GIDSignIn' declares the selector 'handleURL:sourceApplication:annotation:' 3) 'GIDSignIn' 没有可见的@interface 声明选择器'handleURL:sourceApplication:annotation:'

+ (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation: (id)annotation {

  return [[GIDSignIn sharedInstance] handleURL:url
                             sourceApplication:sourceApplication
                                    annotation:annotation];
}

4) Use of undeclared identifier 'kGIDSignInErrorCodeNoSignInHandlersInstalled' 4) 使用未声明的标识符“kGIDSignInErrorCodeNoSignInHandlersInstalled”

case kGIDSignInErrorCodeNoSignInHandlersInstalled:

Please let me know if anyone can help me with this...Thanks!请让我知道是否有人可以帮助我...谢谢!

I am not an expert and fully understand but come up with my own approach after knowing details from documentation.我不是专家并且完全理解,但在从文档中了解详细信息后提出了我自己的方法。

Point 4 is deprecated in 5.0.0 so comment out or delete it.第 4 点在 5.0.0 中已弃用,因此请注释掉或删除它。 Point 1 and Point 2 you need to make entry in GoogleSignIn.h file but as per documentation hasAuthInKeychain is replaced by hasPreviousSignIn and signInSilently has been replace by hasPreviousSignIn.第 1 点和第 2 点您需要在 GoogleSignIn.h 文件中进行输入,但根据文档,hasAuthInKeychain 被替换为 hasPreviousSignIn 并且 signInSilently 已被替换为 hasPreviousSignIn。

You can overcome the error by adding entry for signInSilently and hasAuthInKeychain to GoogleSignIn.h file.您可以通过将 signInSilently 和 hasAuthInKeychain 条目添加到 GoogleSignIn.h 文件来克服该错误。

You can refer the details in https://developers.google.com/identity/sign-in/ios/release .您可以参考https://developers.google.com/identity/sign-in/ios/release中的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM