> For the complete documentation index, see [llms.txt](https://knowledgebase.offer18.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.offer18.com/zh/wang-luo/sdk/ios-sdk.md).

# iOS SDK

要为 Offer18 iOS SDK 实现直接手动导入方法，请按照以下步骤操作：

## 集成步骤：

1. 下载并准备：解压 xcframework.zip 文件，找到 Offer18SDK.xcframework 文件夹。

```
下载链接：
https://web-resources.offer18.net/sdk/ios/build-file/Offer18SDK.xcframework.zip
```

2. 访问 Xcode：在 Xcode 中打开应用项目，并选择相应的项目目标。
3. 导入框架：切换到 General 选项卡，向下滚动到 Frameworks、Libraries 和 Embedded Content 部分。
4. 添加文件：将 Offer18SDK.xcframework 文件夹直接拖放到此部分。
5. 配置嵌入（必需）：您必须确保框架旁边的“Embed”选项设置为 Embed & Sign。注意：如果未选择“Embed & Sign”，应用将在启动时崩溃。

```javascript
let payload: [String: String] = [
    "offerID":123,
    "event": "register",
    "tid": "tid-1234567890",
    "affiliateID": "123",
    "adv_sub1": "advSub1",
    "adv_sub2": "advSub2",
    "adv_sub3": "advSub3",
    "adv_sub4": "advSub4",
    "adv_sub5": "advSub5",
    "adv_sub7": "advSub7",
    "coupon": "coupon_0124",
    "sale": "", //sale amount
    "payout": "", //payout amount
    "p_sub_aff_id": "pSubAffId",
    "p_country": "IN",
    "p_timestamp": "17905634563",
    "p_postbackid": "23dds", //unique postback ID
    "p_package": "package", //package ID
    "status": "1"
]

do {
    Offer18.setDebugLoggingEnabled(true) // debug trace

    try Offer18.configure(domain: domain, accountID: accountID)

    try Offer18.trackConversion(data: payload, completion: { result in
        switch result {
        case .success(let response):
            print(response.responseBody)
            self.trackResponse = response.responseBody
            self.statusMessage = response.message
        case .failure(let error):
            self.trackResponse = error.localizedDescription
            self.statusMessage = "Tracking failed."
            print(error.localizedDescription)
        }
    })
    statusMessage = "SDK configured successfully."
} catch {
    statusMessage = "Initialization failed: \(error)"
    print(error)
}
```


---

# 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://knowledgebase.offer18.com/zh/wang-luo/sdk/ios-sdk.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.
