> ## 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.

# XUserResolveIssueWithUiUtf16Async

> XUserResolveIssueWithUiUtf16Async

# XUserResolveIssueWithUiUtf16Async

顯示系統使用者介面，以使用特定 Unicode URL 解決權杖問題。

## 語法

```cpp theme={null}
HRESULT XUserResolveIssueWithUiUtf16Async(  
         XUserHandle user,  
         const wchar_t* url,  
         XAsyncBlock* async  
)  
```

### 參數

*user*   \_In\_\
類型：XUserHandle

發生權杖問題之使用者的控制代碼。

*url*   \_In\_opt\_z\_\
類型：wchar\_t\*

針對同意等 XBOX Live 問題，請傳遞 **nullptr**。否則，請設定為造成問題之 Web 要求的 Unicode URL。

*async*   \_Inout\_\
類型：XAsyncBlock\*

用於輪詢呼叫狀態及擷取呼叫結果的 [XAsyncBlock](/zh-TW/reference/system/xasync/structs/xasyncblock)。

### 傳回值

類型：HRESULT

如果成功，會傳回 S\_OK；否則會傳回錯誤碼。
如需錯誤碼的清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。

## 備註

如果 XUsers API 傳回 E\_GAMEUSER\_RESOLVE\_USER\_ISSUE\_REQUIRED 錯誤，使用者必須與系統使用者介面 (UI) 互動以解決問題。
呼叫 **XUserResolveIssueWithUiUtf16Async** 以顯示適當的系統 UI。
若要擷取 XUserResolveIssueWithUiUtf16Async 呼叫的結果，請呼叫 [XUserResolveIssueWithUiUtf16Result](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiutf16result)。

若要顯示系統使用者介面，以使用非 Unicode URL 解決權杖問題，請呼叫 [XUserResolveIssueWithUiAsync](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiasync)。

下列範例示範如何顯示系統 UI，以使用 URL 解決權杖問題。

```cpp theme={null}
HRESULT ResolveUserIssueComplete(XAsyncBlock* ab)
{
    if (SUCCEEDED_LOG(XUserResolveIssueWithUiResult(ab)))
    {
        appLog.AddLog("Successfully Resolved User Issue\n");
    }

    return S_OK;
}

HRESULT ResolveUserIssueUtf16Complete(XAsyncBlock* ab)
{
    if (SUCCEEDED_LOG(XUserResolveIssueWithUiUtf16Result(ab)))
    {
        appLog.AddLog("Successfully Resolved User Issue\n");
    }

    return S_OK;
}

HRESULT ResolveUserIssueWithUiAsync(
    XTaskQueueHandle queue,
    const char* narrowUrl = nullptr,
    const wchar_t* wideUrl = nullptr,
    bool useUtf16 = false)
{
    auto resolveAsyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(resolveAsyncBlock.get(), sizeof(*resolveAsyncBlock));
    resolveAsyncBlock->queue = queue;
    resolveAsyncBlock->context = this;

    if (useUtf16)
    {
        resolveAsyncBlock->callback = [](XAsyncBlock* ab)
        {
            auto asyncBlock = std::unique_ptr<XAsyncBlock>(ab);
            LOG_IF_FAILED(static_cast<User*>(ab->context)->ResolveUserIssueUtf16Complete(ab));
        };

        if (SUCCEEDED_LOG(XUserResolveIssueWithUiUtf16Async(
            _handle.get(),
            wideUrl,
            resolveAsyncBlock.get())))
        {
            // The call succeeded, so release the std::unique_ptr ownership of XAsyncBlock* since the callback will take over ownership.
            // If the call fails, the std::unique_ptr will keep ownership and delete the XAsyncBlock*
            resolveAsyncBlock.release();
        }
    }
    else
    {
        resolveAsyncBlock->callback = [](XAsyncBlock* ab)
        {
            auto asyncBlock = std::unique_ptr<XAsyncBlock>(ab);
            LOG_IF_FAILED(static_cast<User*>(ab->context)->ResolveUserIssueComplete(ab));
        };

        if (SUCCEEDED_LOG(XUserResolveIssueWithUiAsync(
            _handle.get(),
            narrowUrl,
            resolveAsyncBlock.get())))
        {
            // The call succeeded, so release the std::unique_ptr ownership of XAsyncBlock* since the callback will take over ownership.
            // If the call fails, the std::unique_ptr will keep ownership and delete the XAsyncBlock*
            resolveAsyncBlock.release();
        }
    }

    return S_OK;
}
```

## 需求

**標頭：** XUser.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、Steam Deck、XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[XUser](/zh-TW/reference/system/xuser/xuser_members)

[XUserResolveIssueWithUiUtf16Result](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiutf16result)

[XUserResolveIssueWithUiAsync](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiasync)


## Related topics

- [XUserResolveIssueWithUiUtf16Async](/reference/system/xuser/functions/xuserresolveissuewithuiutf16async.md)
- [XUserResolveIssueWithUiUtf16Result](/reference/system/xuser/functions/xuserresolveissuewithuiutf16result.md)
