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

# XPersistentLocalStoragePromptUserForSpaceAsync

> XPersistentLocalStoragePromptUserForSpaceAsync

# XPersistentLocalStoragePromptUserForSpaceAsync

允许游戏提示用户释放所请求的可扩展永久本地存储总字节数。

## 语法

```cpp theme={null}
HRESULT XPersistentLocalStoragePromptUserForSpaceAsync(  
         uint64_t requestedBytes,  
         XAsyncBlock* asyncBlock  
)  
```

### 参数

*requestedBytes*   \_In\_\
类型：uint64\_t

游戏希望可供使用的空间总量。

*asyncBlock*   \_Inout\_\
类型：XAsyncBlock\*

用于监视异步调用状态的 XAsyncBlock。

### 返回值

类型：[HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

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

## 备注

在调用之前，游戏应使用 [XPersistentLocalStorageGetSpaceInfo](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo) 检查可用空间。

应在回调函数中通过调用 [XPersistentLocalStoragePromptUserForSpaceResult](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragepromptuserforspaceresult) 来检查请求结果。这并不保证用户释放了所请求的字节数；仅表示用户执行了操作。当用户重试导致空间请求的操作时，你的游戏应再次使用 [XPersistentLocalStorageGetSpaceInfo](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo) 查询可用空间。如果用户选择不释放空间，则异步操作的结果为 E\_ABORT。

永久本地存储未在 PC 平台上实现。虽然该方法存在，但不应在 PC 上使用。

此功能在数据中心流式传输服务器上处于禁用状态。在数据中心流式传输服务器上调用时，它始终返回 E\_ABORT。

## 要求

**头文件：** XPersistentLocalStorage.h

**库：** xgameruntime.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 概念文档

* [XBOX 主机上的本地存储](/build/console-features/storage/local-storage)

## 另请参阅

[XPersistentLocalStorage](/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members)


## Related topics

- [XPersistentLocalStoragePromptUserForSpaceResult](/zh-CN/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragepromptuserforspaceresult.md)
- [XPersistentLocalStorageSpaceInfo](/zh-CN/reference/system/xpersistentlocalstorage/structs/xpersistentlocalstoragespaceinfo.md)
- [XPersistentLocalStorage](/zh-CN/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XPersistentLocalStorageGetSpaceInfo](/zh-CN/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo.md)
