> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PFAuthenticationLoginWithGameCenterAsync

> 使用 iOS Game Center 玩家标识符为用户登录，并返回可用于后续需要经过身份验证的用户的 API 调用的会话标识符。

使用 iOS Game Center 玩家标识符为用户登录，并返回可用于后续需要经过身份验证的用户的 API 调用的会话标识符。如果未在此请求中包含可选的 PublicKeyUrl、Salt、Signature 和 Timestamp 参数，则使用 Game Center ID 登录并不安全。建议通过在 PlayFab Game Manager 中打开 Apple 加载项页面并启用“仅要求此应用使用安全身份验证”选项，来要求在所有 Game Center 调用中都包含这些参数。

## 语法

```cpp theme={null}
HRESULT PFAuthenticationLoginWithGameCenterAsync(  
    PFServiceConfigHandle serviceConfigHandle,  
    const PFAuthenticationLoginWithGameCenterRequest* request,  
    XAsyncBlock* async  
)  
```

### 参数

**`serviceConfigHandle`**   PFServiceConfigHandle

从 PFServiceConfigCreateHandle 调用返回的 PFServiceConfigHandle。

**`request`**   [PFAuthenticationLoginWithGameCenterRequest\*](/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationloginwithgamecenterrequest)

已填充的请求对象。

**`async`**   XAsyncBlock\*<br />*Inout*

用于异步操作的 XAsyncBlock。

### 返回值

类型：HRESULT

此 API 操作的结果代码。

## 备注

此 API 可在 iOS 上使用。Game Center 玩家标识符 ([https://developer.apple.com/library/ios/documentation/Accounts/Reference/ACAccountClassRef/index.html#](https://developer.apple.com/library/ios/documentation/Accounts/Reference/ACAccountClassRef/index.html#) // apple\_ref/occ/instp/ACAccount/identifier) 是存储在本地设备上的生成字符串。与设备标识符一样，必须小心，切勿将玩家的 Game Center 标识符公开给最终用户，否则可能会导致用户帐户遭到入侵。如果这是用户首次使用 Game Center 登录且 CreateAccount 设为 true，将创建一个新的 PlayFab 帐户并链接到该 Game Center 标识符。在这种情况下，该 PlayFab 帐户将没有关联的电子邮件或用户名。否则，如果没有 PlayFab 帐户链接到该 Game Center 帐户，将返回相应的错误，以便游戏引导用户创建 PlayFab 帐户。如果使用的是无效的 iOS Game Center 玩家标识符，将返回相应的错误。另请参阅 ClientLoginWithIOSDeviceIDAsync。异步任务完成后，调用 [PFAuthenticationLoginWithGameCenterGetResult](/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgamecentergetresult) 获取结果。

## 要求

**头文件：** PFAuthentication.h

## 另请参阅

[PFAuthentication 成员](/services/playfab/api-references/c/pfauthentication/pfauthentication_members)


## Related topics

- [PFAuthenticationLoginWithGameCenterGetResultSize](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgamecentergetresultsize.md)
- [PFAuthenticationLoginWithGameCenterGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgamecentergetresult.md)
- [服务 C API 概览 - PFAuthentication.h](/zh-CN/services/playfab/api-references/c/pfauthentication/pfauthentication_members.md)
- [PFAuthenticationReLoginWithGameCenterAsync](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationreloginwithgamecenterasync.md)
- [PFAuthenticationLoginWithGameCenterRequest](/zh-CN/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationloginwithgamecenterrequest.md)
