绑定第三方账号

业务场景

用于游戏直接调用接口实现第三方账号绑定

注意事项

  • 如游戏无自定义 UI 需求, 可直接使用 SDK 用户中心的第三方账号绑定功能

流程图

接口介绍

/**
* 绑定第三方账号
*【iOS】海外
*/
- (void)BindThirdPlatform:(BindPlatform)platform;

调用示例

// 监听回调通知

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onBindPlatformSuccess:) name:NOTIFICATION_BIND_ACCOUNT_SUCCESS object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onBindPlatformFailed:) name:NOTIFICATION_BIND_ACCOUNT_FAILED object:nil];


// 接口调用
// 传入平台类型 调用平台绑定
NSInteger type = 0;
    switch (tag) {
        case 1:
            type = BIND_APPLEID;
            break;
        case 2:
            type = BIND_GAMECENTER;
            break;
        case 3:
            type = BIND_PLAT_ACCOUNT;
            break;
        case 4:
            type = BIND_FACEBOOK;
            break;
        case 5:
            type = BIND_LINE;
            break;
        case 6:
            type = BIND_NAVER;
            break;
        case 7:
            type = BIND_GOOGLE;
            break;
        default:
            break;
    }
[[SDKManager getInstance] BindThirdPlatform:type];

// 回调方法
- (void)onBindPlatformSuccess:(NSNotification *)notif
{
    // 获取绑定平台
    NSInteger bind_platform = [notif.userInfo[KEY_BIND_PLATFORM] integerValue];
    // 获取绑定状态:YES为绑定成功,NO为绑定失败
    BOOL bind_status = [notif.userInfo[KEY_BIND_STATUS] boolValue];
}

- (void)onBindPlatformFailed:(NSNotification *)notif
{
    NSDictionary *errorInfo = notif.userInfo;
    NSInteger errorCode = [[errorInfo objectForKey:KEY_ERROR_CODE] integerValue];
    NSString *errorMsg = [errorInfo objectForKey:KEY_ERROR_MSG];
}

参数说明

入参

BIND_PLATFORM_TYPE

枚举值(NSInteger)说明
BIND_FACEBOOK1绑定 Facebook 账号
BIND_GOOGLE2绑定 Google 账号
BIND_APPLEID3绑定 Apple 账号
BIND_GAMECENTER4绑定 AppleGameCenter 账号
BIND_LINE5绑定 LINE 账号
BIND_NAVER6绑定 Naver 账号
BIND_PLAT_ACCOUNT7绑定平台账号
BIND_CODE8引继码

出参

BindAccountResult result

参数名称类型说明
bind_platformBIND_PLATFORM_TYPE绑定的平台类型
bind_statusBOOL是否绑定成功的标识

错误码

FAQ