绑定第三方账号
业务场景
用于游戏直接调用接口实现第三方账号绑定
注意事项
- 如游戏无自定义 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_FACEBOOK | 1 | 绑定 Facebook 账号 |
BIND_GOOGLE | 2 | 绑定 Google 账号 |
BIND_APPLEID | 3 | 绑定 Apple 账号 |
BIND_GAMECENTER | 4 | 绑定 AppleGameCenter 账号 |
BIND_LINE | 5 | 绑定 LINE 账号 |
BIND_NAVER | 6 | 绑定 Naver 账号 |
BIND_PLAT_ACCOUNT | 7 | 绑定平台账号 |
BIND_CODE | 8 | 引继码 |
出参
BindAccountResult result
参数名称 | 类型 | 说明 |
---|---|---|
bind_platform | BIND_PLATFORM_TYPE | 绑定的平台类型 |
bind_status | BOOL | 是否绑定成功的标识 |
错误码
无
FAQ
无