Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Nativescript iOS应用程序中使用Google实现登录?_Ios_Angular_Typescript_Nativescript_Angular2 Nativescript - Fatal编程技术网

如何在Nativescript iOS应用程序中使用Google实现登录?

如何在Nativescript iOS应用程序中使用Google实现登录?,ios,angular,typescript,nativescript,angular2-nativescript,Ios,Angular,Typescript,Nativescript,Angular2 Nativescript,我正试图通过Nativescript社交登录插件在Nativescript中实现google的id提供者登录,目前为止它在Android中运行良好,但在iOS中根本不起作用 按照插件创建者的指示,我注意到一些类需要额外的typescript定义文件,因此在研究这个问题时,我发现使用google登录的方法最近在iOS中发生了变化,一些POD已经被弃用。我试着遵循新方法,我自己为GIDSignIn委托定义了一个d.ts文件,如下所示 declare class GIDSignIn{ publi

我正试图通过Nativescript社交登录插件在Nativescript中实现google的id提供者登录,目前为止它在Android中运行良好,但在iOS中根本不起作用

按照插件创建者的指示,我注意到一些类需要额外的typescript定义文件,因此在研究这个问题时,我发现使用google登录的方法最近在iOS中发生了变化,一些POD已经被弃用。我试着遵循新方法,我自己为GIDSignIn委托定义了一个d.ts文件,如下所示

declare class GIDSignIn{
   public static sharedInstance(): GIDSignIn;
   public handleURLSourceApplication(url: NSURL, sourceApplication:NSString, annotiation: id): boolean;
}
但即使应用程序以这种方式编译,只要我点击登录按钮,它就会崩溃


通过检查内置xcode,我得到一条警告,指出Firebase Instance尚未配置,我应该如何在Typescript代码中配置它,使用nativescript oauth插件登录social

范例

login.component.ts:-

`import * as tnsOAuthModule from 'nativescript-oauth';

public login() {

    tnsOAuthModule.login()

        .then(() => {

            let tokenModule = JSON.stringify(tnsOAuthModule);

            let refereshToken = JSON.parse(tokenModule).instance.tokenResult.refreshToken;

            this.getRefereshActiveToken(refereshToken);
        })

        .catch((er) => {

            console.error('error logging in');

            console.dir(er);

        });

}`
在main.ts文件中添加google身份验证配置,如

对于IOS,只有在App\u Resources->IOS->info.plist文件中通过google身份验证后,才能添加此代码进行重定向。

<key>CFBundleURLTypes</key>

<array>

    <dict>

        <key>CFBundleTypeRole</key>

        <string>Editor</string>

        <key>CFBundleURLName</key>

        <string>app_id</string>

        <key>CFBundleURLSchemes</key>

        <array>

            <string>appauth</string>

        </array>

    </dict>

</array>

<key>NSAppTransportSecurity</key>

<dict>

    <key>NSAllowsArbitraryLoads</key>

    <true/>

</dict>
CbundleUrlTypes
CbundleTypeRole
编辑
CFBundleURLName
应用程序id
循环流化床锅炉方案
阿帕斯
NSAppTransportSecurity
NSAllowsArbitraryLoads

您能否分享一个可以重现问题的最小样本项目?除此之外,还有其他插件,如or,也实现了GoogleSignin。
<key>CFBundleURLTypes</key>

<array>

    <dict>

        <key>CFBundleTypeRole</key>

        <string>Editor</string>

        <key>CFBundleURLName</key>

        <string>app_id</string>

        <key>CFBundleURLSchemes</key>

        <array>

            <string>appauth</string>

        </array>

    </dict>

</array>

<key>NSAppTransportSecurity</key>

<dict>

    <key>NSAllowsArbitraryLoads</key>

    <true/>

</dict>