> ## 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](/reference/system/xasync/structs/xasyncblock)。

### 返回值

类型：HRESULT

如果成功，则返回 S\_OK；否则返回错误代码。
有关错误代码列表，请参阅[错误代码](/reference/errorcodes)。

## 注解

如果 XUsers API 返回 E\_GAMEUSER\_RESOLVE\_USER\_ISSUE\_REQUIRED 错误，则用户必须与系统用户界面 (UI) 进行交互以解决该问题。
调用 **XUserResolveIssueWithUiUtf16Async** 以显示相应的系统 UI。
若要检索调用 XUserResolveIssueWithUiUtf16Async 的结果，请调用 [XUserResolveIssueWithUiUtf16Result](/reference/system/xuser/functions/xuserresolveissuewithuiutf16result)。

若要显示用于通过非 Unicode URL 解决令牌问题的系统用户界面，请调用 [XUserResolveIssueWithUiAsync](/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](/reference/system/xuser/xuser_members)

[XUserResolveIssueWithUiUtf16Result](/reference/system/xuser/functions/xuserresolveissuewithuiutf16result)

[XUserResolveIssueWithUiAsync](/reference/system/xuser/functions/xuserresolveissuewithuiasync)


## Related topics

- [XUserResolveIssueWithUiUtf16Result](/zh-CN/reference/system/xuser/functions/xuserresolveissuewithuiutf16result.md)
- [XUserResolveIssueWithUiResult](/zh-CN/reference/system/xuser/functions/xuserresolveissuewithuiresult.md)
- [XUserResolveIssueWithUiAsync](/zh-CN/reference/system/xuser/functions/xuserresolveissuewithuiasync.md)
- [XUser](/zh-CN/reference/system/xuser/xuser_members.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
