iOS SDK_第三方账户关联

可以在一个游戏账户中关联或解除关联多个第三方账户。

账户关联功能


如要使用Google、Facebook、NAVER等第三方账户的关联功能,请使用下列代码。

#import <GamePotChannel/GamePotChannel.h>

// 定义类型
// GamePotChannelType.GOOGLE
// GamePotChannelType.FACEBOOK
// GamePotChannelType.LINE
// GamePotChannelType.TWITTER
// GamePotChannelType.NAVER
// GamePotChannelType.APPLE

[[GamePotChannel getInstance] CreateLinking:GOOGLE viewController:self success:^(GamePotUserInfo *userInfo) {
    // 关联成功。请在游戏弹窗显示关联结果相关消息。(例如:账户关联成功。)
} cancel:^{
    // 用户取消
} fail:^(NSError *error) {
    // 关联失败。请在游戏弹窗显示失败原因相关消息。
    // 消息语句请使用[error localizedDescription]。
}];

关联列表确认功能


如要确认与账户关联的第三方账户列表,请使用下列代码。

#import <GamePotChannel/GamePotChannel.h>

// 定义类型
// GamePotChannelType.GOOGLE
// GamePotChannelType.FACEBOOK
// GamePotChannelType.LINE
// GamePotChannelType.TWITTER
// GamePotChannelType.NAVER
// GamePotChannelType.APPLE

// 返回各类型的关联结果。 
BOOL isGoogleLinked = [[GamePotChannel getInstance] isLinked:GOOGLE];

// 对已关联的类型,以JsonString格式返回。
NSString* linkedList = [[GamePotChannel getInstance] getLinkedListJsonString];

解除关联功能


如要使用解除与第三方账户的关联功能,请使用下列代码。

#import <GamePotChannel/GamePotChannel.h>

[[GamePotChannel getInstance] DeleteLinking:GOOGLE success:^{
     // 解除成功。请在游戏弹窗显示关联结果相关消息。(例如:已解除账户关联。)
} fail:^(NSError *error) {
     // 解除失败。请在游戏弹窗显示失败原因相关消息。
     // 消息语句请使用[error localizedDescription]。
}];

Last updated