---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.4
alternate:
  - https://appmetrica.yandex.com/docs/en/sdk/ios/analytics/swift/ReporterConfiguration.md
  - https://appmetrica.yandex.com/docs/ru/sdk/ios/analytics/swift/ReporterConfiguration.md
  - https://appmetrica.yandex.com/docs/zh/sdk/ios/analytics/swift/ReporterConfiguration.md
  - href: https://appmetrica.yandex.com/docs/zh/sdk/ios/analytics/swift/ReporterConfiguration.md
    type: text/markdown
    title: Markdown version
  - href: https://appmetrica.yandex.com/docs/zh/llms.txt?revision=r21698989
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://appmetrica.yandex.com/docs/zh/llms.txt?revision=r21698989

# ReporterConfiguration 类

此类包含报告器的扩展不可变配置。

使用 [MutableReporterConfiguration](https://appmetrica.yandex.com/docs/zh/sdk/ios/analytics/swift/MutableReporterConfiguration.md) 类来修改报告器的配置。

## Instance methods {#instance_summary}

#|
|| [初始化？(apiKey:)](#method_initWithApiKey) | 使用指定的 API 密钥初始化 `ReporterConfiguration` 类的实例。 ||
|#

## Properties {#property_summary}

#|
|| [apiKey](#property_apiKey) | API 密钥，与主应用程序的 API 密钥不同。 ||
|| [areLogsEnabled](#property_areLogsEnabled) | 一个标志，表示报告者的日志记录已启用。 ||
|| [dataSendingEnabled](#property_dataSendingEnabled) | 一个标志，表示已启用发送统计数据。 ||
|| [dispatchPeriod](#property_dispatchPeriod) | 事件发送间隔时间（秒）。 ||
|| [maxReportsCount](#property_maxReportsCount) | 当事件数量达到`maxReportsCount`时，会触发发送事件。 ||
|| [maxReportsInDatabaseCount](#property_maxReportsInDatabaseCount) | 内部数据库中存储错误报告的最大数量。 ||
|| [sessionTimeout](#property_sessionTimeout) | 会话超时时间（秒）。 ||
|| [userProfileID](#property_userProfileID) | 设置用户资料ID（`ProfileID`）在激活时。 ||
|#

## Method descriptions {#method_detail}

### init?(apiKey:) {#method_initWithApiKey}

```objectivec translate=no
init?(apiKey: String)
```

使用指定的API密钥初始化`ReporterConfiguration`类的实例。

**参数：**

#|
|| `apiKey` | API 密钥，与主要应用的 API 密钥不同。 ||
|#

**返回：**

The `ReporterConfiguration` 类实例。

## Property descriptions {#property_detail}

### apiKey {#property_apiKey}

`var apiKey: String? { get }`

API 密钥，与主应用程序的 API 密钥不同。

### areLogsEnabled {#property_areLogsEnabled}

`var areLogsEnabled: Bool { get }`

表示报告者日志已启用的标志。

默认值是`NO`.

可能的值：

- `是`：已启用报告日志。
- `无`：报告记录已禁用。

### dataSendingEnabled {#property_dataSendingEnabled}

`var dataSendingEnabled: Bool { get }`

一个标志，表示已启用发送统计数据。
默认值是`YES`.

可能的值：
- `是`：已启用发送统计数据。
- `无`：统计发送已禁用。

### dispatchPeriod {#property_dispatchPeriod}

`var dispatchPeriod: UInt { get }`

事件发送间隔时间（秒）。

### maxReportsCount {#property_maxReportsCount}

`var maxReportsCount: UInt { get }`

当事件数量达到`maxReportsCount`时，会触发发送事件。

### maxReportsInDatabaseCount {#property_maxReportsInDatabaseCount}

`var maxReportsInDatabaseCount { get }`

内部数据库中存储的错误报告最大数量。

允许的值范围是 [100; 10,000]。 超出此范围的值会自动替换为最接近范围边界的值。

默认值：1000。

{% note info %}

不同的数据库用于各个 `apiKeys`，并可为它们设置独立的事件数量限制。 此参数仅影响对应的`apiKey`的限制。 要修改其他 `apiKeys` 的最大允许事件数，请使用 [AppMetricaConfiguration.maxReportsInDatabaseCount](https://appmetrica.yandex.com/docs/zh/sdk/ios/analytics/swift/AppMetricaConfiguration.md#property_maxReportsInDatabaseCount)。

{% endnote %}

### sessionTimeout {#property_sessionTimeout}

`var sessionTimeout: UInt { get }`

会话超时时间（秒）。

默认值是`10`（最小允许值）。

### userProfileID {#property_userProfileID}

`var userProfileID: String? { get }`

设置用户资料的 ID (`ProfileID`) 当激活时。

{% note alert %}

`ProfileID`字符串的最大长度为 200 个字符。

{% endnote %}
