> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-zh/common/network-environment/version.md).

# 版本

### 1. 获取 Toss 应用版本（`getTossAppVersion`)

`getTossAppVersion` 该函数会获取 Toss 应用版本。例如， `5.206.0`会以如下形式返回。用于将 Toss 应用版本记录到日志，或在某些功能仅在特定版本及以上运行时使用。

**签名**

```typescript
function getTossAppVersion(): string;
```

**返回值**

* string

  Toss 应用版本

**示例**

{% tabs %}
{% tab title="js" %}

```js
import { getTossAppVersion } from '@apps-in-toss/web-framework';

const tossAppVersion = getTossAppVersion();
```

{% endtab %}

{% tab title="React" %}

```tsx
import { getTossAppVersion } from '@apps-in-toss/web-framework';
import { Text } from '@toss/tds-mobile';

function TossAppVersionPage() {
  const tossAppVersion = getTossAppVersion();

  return <Text>{tossAppVersion}</Text>;
}
```

{% endtab %}

{% tab title="React Native" %}

```tsx
import { getTossAppVersion } from '@apps-in-toss/framework';
import { Text } from '@toss/tds-react-native';

function TossAppVersionPage() {
  const tossAppVersion = getTossAppVersion();

  return <Text>{tossAppVersion}</Text>;
}
```

{% endtab %}
{% endtabs %}

***

### 2. 检查应用最低版本（`isMinVersionSupported`)

该函数会检查当前运行中的 Toss 应用版本是否满足通过参数传入的最低版本要求。当某个功能仅在最新版本中可用时，可以提示用户更新应用。

**签名**

```typescript
function isMinVersionSupported(minVersions: {
  android: `${number}.${number}.${number}` | 'always' | 'never';
  ios: `${number}.${number}.${number}` | 'always' | 'never';
}): boolean;
```

**参数**

* **minVersions** · 必填 · `Object`

  指定各平台最低版本要求的对象。

  * **minVersions.android** · 必填 · `(`${number}.${number}.${number} `| &#39;always&#39; | &#39;never&#39; )`

    这是 Android 平台的最低版本要求。
  * **minVersions.ios** · 必填 · `(`${number}.${number}.${number} `| &#39;always&#39; | &#39;never&#39; )`

    这是 iOS 平台的最低版本要求。

**返回值**

* boolean

  如果当前应用版本高于或等于最低版本，则返回 true，否则返回 false。

**示例**

{% tabs %}
{% tab title="js" %}

```js
import { isMinVersionSupported } from '@apps-in-toss/web-framework';

const isSupported = isMinVersionSupported({
  android: '1.2.0',
  ios: '1.3.0',
});
```

{% endtab %}

{% tab title="React" %}

```tsx
import { isMinVersionSupported } from '@apps-in-toss/web-framework';
import { Text } from '@toss/tds-mobile';

function VersionCheck() {
  const isSupported = isMinVersionSupported({
    android: '1.2.0',
    ios: '1.3.0',
  });

  return <div>{!isSupported && <Text>需要更新到最新版本。</Text>};
}
```

{% endtab %}

{% tab title="React Native" %}

```tsx
import { isMinVersionSupported } from '@apps-in-toss/framework';
import { Text } from '@toss/tds-react-native';
import { View } from 'react-native';

function VersionCheck() {
  const isSupported = isMinVersionSupported({
    android: '1.2.0',
    ios: '1.3.0',
  });

  return <View>{!isSupported && <Text>需要更新到最新版本。</Text>}</View>;
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-zh/common/network-environment/version.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
