Angular Nativescript谷歌登录(ios)

Angular Nativescript谷歌登录(ios),angular,nativescript,google-signin,Angular,Nativescript,Google Signin,在我的nativescript angular应用程序中,我尝试使用google和nativescript社交登录插件实现登录。尝试使用loginWithGoogle函数将退出应用程序(但不会引发任何错误) 贝娄,你可以看到我的代码 info.plist <key>CFBundleURLTypes</key> <array> <!-- GOOGLE START --> <dict> <key>

在我的nativescript angular应用程序中,我尝试使用google和nativescript社交登录插件实现登录。尝试使用loginWithGoogle函数将退出应用程序(但不会引发任何错误)

贝娄,你可以看到我的代码

info.plist

<key>CFBundleURLTypes</key>
<array>
    <!-- GOOGLE START -->
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>com.googleusercontent.apps.xxxxxxx</string>
        </array>
    </dict>
    <!-- GOOGLE END -->
</array>
login.component.ts

class MyDelegate extends UIResponder implements UIApplicationDelegate {
static ObjCProtocols = [UIApplicationDelegate];

applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: any): boolean {
let gglDelegate = false;

try {
  const errorRef = new interop.Reference();
  GGLContext.sharedInstance().configureWithError(errorRef);

  const signIn = GIDSignIn.sharedInstance();
  gglDelegate = true;
} catch (error) {
  console.log(error);
}

return gglDelegate;
}

applicationOpenURLSourceApplicationAnnotation(application, url, sourceApplication, annotation) {
const gglDelegate = GIDSignIn.sharedInstance().handleURLSourceApplicationAnnotation(url, sourceApplication, annotation);

return gglDelegate;
   }
}
application.ios.delegate = MyDelegate;
const google = {
initialize: true,
serverClientId: "xxxx.apps.googleusercontent.com", //this is from the ios id in my google console
isRequestAuthCode: true
 };
let result = SocialLogin.init({google});
 SocialLogin.addLogger((msg: any, tag: string) => {
    console.log(`[nativescript-social-login]: (+ ${tag} +): + ${msg}`);
 });
googleLogin() {
try {
  SocialLogin.loginWithGoogle((result) => {
          this.ngZone.run(() => {
              console.log("code: " + result.code);
              console.log("error: " + result.error);
              console.log("userToken: " + result.userToken);
              console.log("displayName: " + result.displayName);
              console.log("photo: " + result.photo);
              console.log("authToken: " + result.authToken);
          });
      });
} catch (e) {
  console.error(`[Error]: ${e}`);
  }
}
当我记录.init函数的结果时,我得到

CONSOLE LOG file:///app/main.js:49:12: {"facebook":{"isInitialized":true},"google":{"isInitialized":true},"twitter":{}}
不太确定下一步该去哪里


提前感谢您的任何想法。

试试这个,或者如果有问题,您可以尝试另一个登录插件
nativescript plugin firebase
,它在我这边非常有效谢谢您的评论!我试着按照这个链接的建议添加钩子和授权文件,但当我点击谷歌登录时,应用程序仍然会退出。我会尝试一下firbase,但它是一个没有firebase的解决方案,对于我的情况来说是最佳的。