> ## 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 附加元件頁面，並啟用 'Require secure authentication only for this app' 選項，以在所有 Game Center 呼叫中要求這些參數。

## 語法

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

### 參數

**`serviceConfigHandle`**   PFServiceConfigHandle

從 PFServiceConfigCreateHandle 呼叫傳回的 PFServiceConfigHandle。

**`request`**   [PFAuthenticationLoginWithGameCenterRequest\*](/zh-TW/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](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgamecentergetresult) 以取得結果。

## 需求

**標頭：** PFAuthentication.h

## 另請參閱

[PFAuthentication 成員](/zh-TW/services/playfab/api-references/c/pfauthentication/pfauthentication_members)


## Related topics

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