iOS SDK_登录相关功能

集成Google、Facebook、NAVER等各种登录SDK功能,可在GAMEPOT iOS SDK中使用。

不支持登錄推特。

使用前设置


// AppDelegate.m
#import <GamePotChannel/GamePotChannel.h>

// 使用Google登录时
#import <GamePotGoogleSignIn/GamePotGoogleSignIn.h>

// 使用Facebook登录时
#import <GamePotFacebook/GamePotFacebook.h>

// 使用Apple ID登录时
#import <GamePotApple/GamePotApple.h>

// 使用LINE登录时
#import <GamePotLine/GamePotLine.h>

// 使用Twitter登录时
#import <GamePotTwitter/GamePotTwitter.h>

// 使用NAVER登录时
#import <GamePotNaver/GamePotNaver.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...
    // 重置GamePotSDK频道。需按照所需频道使用addChannel(默认包括Guest方式)。
    // 重置Google登录
    GamePotChannelInterface* google     = [[GamePotGoogleSignIn alloc] init];
    [[GamePotChannelManager getInstance] addChannelWithType:GOOGLE interface:google];

    // 重置Facebook登录
    GamePotChannelInterface* facebook   = [[GamePotFacebook alloc] init];
    [[GamePotChannelManager getInstance] addChannelWithType:FACEBOOK interface:facebook];

    // 重置Apple ID登录
    GamePotChannelInterface* apple      = [[GamePotApple alloc] init];
    [[GamePotChannel getInstance] addChannelWithType:APPLE interface:apple];

    // LINE登录初始化
    GamePotChannelInterface* line = [[GamePotLine alloc] init];
    [[GamePotChannel getInstance] addChannelWithType:LINE interface:line];

    // 重置Twitter登录
    GamePotChannelInterface* twitter = [[GamePotTwitter alloc] init];
    [[GamePotChannel getInstance] addChannelWithType:TWITTER interface:twitter];

      // NAVER登录初始化
      GamePotChannelInterface* naver = [[GamePotNaver alloc] init];
      [[GamePotChannel getInstance] addChannelWithType:NAVER interface:naver];

    // 进行登录处理时需要。
    [[GamePotChannel getInstance] application:application didFinishLaunchingWithOptions:launchOptions];

    ...
}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
    // 进行登录处理时需要。
    BOOL nChannelResult = [[GamePotChannel getInstance] application:app openURL:url options:options];
    return nChannelResult;
}

登录功能


如要使用根据开发商实现的登录UI点击登录按钮时操作的SDK登录功能,请使用下列代码。

自动登录功能


如要使用通过传输会员最后一次登录信息的API自动登录功能时,请使用下列代码。

退出登录功能


如要使用退出功能,请使用下列代码。

会员注销功能


如要使用会员注销功能,请使用下列代码。

登录验证功能


登录成功并由开发商服务器向GAMEPOT服务器传递登录信息后,即可进行登录验证。

详细说明请参考登录验证请求

Last updated