抖音开放平台Logo
开发者文档
控制台
  • API 概览
  • C# API
  • 开放接口
  • 转发
  • 群聊
  • 关注
  • 数据分析
  • 基础
  • 渲染
  • 设备
  • 文件
  • 位置
  • 媒体
  • 网络
  • 转发
  • 数据缓存
  • 本地数据缓存
  • tt.clearStorage
  • tt.clearStorageSync
  • tt.getStorage
  • tt.getStorageSync
  • tt.getStorageInfo
  • tt.getStorageInfoSync
  • tt.removeStorage
  • tt.removeStorageSync
  • tt.setStorage
  • tt.setStorageSync
  • 广告
  • 界面
  • 支付
  • Worker
  • tt.clearStorageSync
    收藏
    我的收藏

    基础库 1.0.0 开始支持本方法,这是一个同步方法。

    清理 全部 本地数据缓存的同步接口。

    前提条件
    业务背景
    使用限制
    注意事项

    该方法无参数,也没有返回值,所以无法判断接口是否调用失败。

    相关教程

    语法

    tt.clearStorageSync()

    参数说明

    返回值

    错误码

    errNoerrMsg说明最低支持版本
    21101clear storage fail
    小游戏框架内部错误,有需要请创建工单咨询
    1.0.0
    20000internal error
    小游戏框架内部错误,有需要请创建工单咨询
    1.0.0
    -1promise not call
    小游戏框架内部错误,有需要请创建工单咨询
    1.0.0
    21000localStorage removeAllObjects failed
    小游戏框架内部错误,有需要请创建工单咨询
    1.0.0
    20000key is illegal
    1.0.0

    扫码体验

    请使用字节宿主APP扫码

    代码示例

    开发者工具中预览

    try { tt.clearStorageSync(); console.log(`clearStorageSync调用成功`); } catch (error) { console.log(`clearStorageSync调用失败`); }