# iOS SDK\_第三方账户关联

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

&#x20;

## **账户关联功能** <a href="#zhang-hu-guan-lian-gong-neng" id="zhang-hu-guan-lian-gong-neng"></a>

***

如要使用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]。
}];
```

## **关联列表确认功能** <a href="#guan-lian-lie-biao-que-ren-gong-neng" id="guan-lian-lie-biao-que-ren-gong-neng"></a>

***

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

```
#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];
```

## **解除关联功能** <a href="#jie-chu-guan-lian-gong-neng" id="jie-chu-guan-lian-gong-neng"></a>

***

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

```
#import <GamePotChannel/GamePotChannel.h>

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gamepot.io/basics/gamepot-2.0/zhong-wen/ios-sdk/ios-sdk-di-san-fang-zhang-hu-guan-lian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
