For the complete documentation index, see llms.txt. This page is also available as Markdown.

User.getDeclaredAgeRange

函数式 API getDeclaredAgeRange也可以通过它使用相同的功能。

功能说明

查询 iOS 中声明的年龄范围。

仅限 iOS 这是 API。需要 iOS 26 以上,且安装了 Toss App iOS 5.266.0 仅可在以上版本使用 — 不支持 Android。调用前 User.getDeclaredAgeRange.isSupported()可通过它确认是否支持。

类型

User.getDeclaredAgeRange(params: GetDeclaredAgeRangeParams): Promise<DeclaredAgeRange>;

Params

interface GetDeclaredAgeRangeParams {
  ageGates: number[];
}

Response

interface DeclaredAgeRange {
  status:
    | "SHARING"
    | "DECLINED_SHARING"
    | "UNSUPPORTED_OS"
    | "NOT_AVAILABLE"
    | "INVALID_REQUEST"
    | "FAILED";
  lowerBound?: number;
  upperBound?: number;
  ageRangeDeclaration?: string;
  activeParentalControls: string[];
  isEligibleForAgeFeatures?: boolean;
  errorCode?: string;
}

错误

错误代码是 catch 到的错误的 error.code 值。

代码
说明

UNSUPPORTED_OS_VERSION

如果设备的 OS 低于 iOS 26 或不是 iOS,调用会立即发生。 User.getDeclaredAgeRange.isSupported()可通过它提前确认,发生时 error.message请向用户显示(OS 更新提示文案)。

UNSUPPORTED_APP_VERSION

如果正在运行的 Toss App 版本低于 iOS 5.266.0,调用会立即发生。 User.getDeclaredAgeRange.isSupported()可通过它提前确认,发生时 error.message请向用户显示(Toss App 更新提示文案)。

示例代码

这有帮助吗?