> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# fetchTemplate

APISummary
`LynxEngine` 内部调用此方法来获取 `Bundle` 和 `Lazy Bundle` 的内容。返回结果类型可以包含 `byte[]` 或 `TemplateBundle`。

## 语法

### Android

```java
public abstract void fetchTemplate(
    LynxResourceRequest request, LynxResourceCallback<TemplateProviderResult> callback);
```

#### 参数说明

- `request`: 请求所需的内容文件。
- `callback`: 响应所需的内容文件：`byteArray` 或 `TemplateBundle`。

:::note

- 此方法必须实现。

:::

### iOS

```objc
- (void)fetchTemplate:(LynxResourceRequest *_Nonnull)request
           onComplete:(LynxTemplateResourceCompletionBlock _Nonnull)callback;
```

#### 参数说明

- `request`: 请求所需的内容文件。
- `callback`: 响应所需的内容文件：`byteArray` 或 `TemplateBundle`。

:::note

- 此方法必须实现。

:::

### Harmony

```typescript
abstract fetchTemplate(request: LynxResourceRequest, callback: AsyncCallback<TemplateProviderResult>): void;
```

#### 参数说明

- `request`: 获取 `Bundle` 和 `Lazy Bundle` 内容的请求。
- `callback`: 以 `ArrayBuffer` 类型响应所需的内容文件。

## 兼容性

**Compatibility Table**

**Query:** `lynx-native-api.lynx-template-resource-fetcher.fetch-template`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/lynx-template-resource-fetcher/fetch-template.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| fetch-template | Yes (2.8) | Yes (3.4) | Yes (2.8) | No | No | No |

**`fetch-template`**

LynxEngine internally calls this method to obtain the contents of Bundle and Lazy Bundle. The returned result type can contain byte[] or TemplateBundle.

**Specifications:**

