# 入门指南

## 开始

要展示Adx3广告，第一步就是将Adx3移动广告SDK集成到应用中。集成广告SDK后，您可以继续植入一种或者多种支持的广告格式

## 前提条件

* 使用 Xcode 13.4.1 或者更高版本
* 以 iOS 10.0 或者更高版本为目标平台
* 推荐：管理端后台申请 SDK 和广告位 ID

## 导入移动广告SDK

1.下载SDK：

<https://pub-block.s3.ap-east-1.amazonaws.com/base/202306/4fd9e3ee1bfc0c6b.zip>

2.解压 SDK 框架，然后将以下框架导入您的 Xcode 项目：

* Adx3Framework.framework

3.在项目的 build 设置中，将 `-ObjC` 链接器标志添加到 **Other Linker Flags**：

<figure><img src="/files/5tuvUHF4vxDbetQ579HW" alt=""><figcaption></figcaption></figure>

## 更新您的 Info.plist 文件

更新应用的 Info.plist 文件添加以下键：

```
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
```

## 初始化广告 SDK

在加载广告之前，请在 <mark style="color:blue;">\[Adx3AdManager sharedManager]</mark> 上调用 initWithAppId:(NSString \*)appId success:(isSuccess)success 方法，该方法将初始化 SDK，并在初始化完成之后，回调初始化的结果。此操作仅需执行一次，最好是在应用启动时执行。建议您尽早调用 initWithAppId:(NSString \*)appId success:(isSuccess)success

以下示例展示了如何在 Appdelegate 中调用 initWithAppId:(NSString \*)appId success:(isSuccess)success 方法

#### AppDelegate.m 示例

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

```swift
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        Adx3AdManager.shared().initWithAppId("Your App ID") { isSuccess in
            //result handler
        }
        // Override point for customization after application launch.
        return true
    }
    
    func applicationDidBecomeActive(_ application: UIApplication) {
        Adx3AdManager.shared().applicationDidBecomeActive(application)
    }
    
    func applicationDidEnterBackground(_ application: UIApplication) {
        Adx3AdManager.shared().applicationDidEnterBackground(application)
    }
   
}
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
#import "Adx3Framework/Adx3Ad.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [[Adx3AdManager sharedManager] initWithAppId:@"Your App ID" success:^(BOOL isSuccess) {
       //result handler
    }];
    return YES;
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [[Adx3AdManager sharedManager] applicationDidBecomeActive:application];
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    [[Adx3AdManager sharedManager] applicationDidEnterBackground:application];
}


@end
```

{% endtab %}
{% endtabs %}

## 选择广告格式

### 开屏

<div align="left"><figure><img src="/files/wsRZ7wvShITeXbQI2EmR" alt=""><figcaption></figcaption></figure></div>

开屏广告是一种特殊的广告格式，适合希望通过应用启动时加载广告的发布商。用户可以随时关闭开屏广告。

[植入开屏广告](/copy-of-cn/jie-kou-wen-dang/ios/guang-gao-ge-shi/kai-ping-guang-gao.md)

### 横幅

<div align="left"><figure><img src="/files/ycv7P48L4kDZT0tnr1SD" alt=""><figcaption></figcaption></figure></div>

横幅广告是在设备屏幕的顶部或底部展示的矩形广告。 用户与应用互动时，横幅广告会停留在屏幕上，并且可在一段时间后自动刷新。

[植入横幅广告](/copy-of-cn/jie-kou-wen-dang/ios/guang-gao-ge-shi/heng-fu-guang-gao.md)

### 插屏

<div align="left"><figure><img src="/files/o15YcPxnCr0qk2hmepVV" alt=""><figcaption></figcaption></figure></div>

覆盖应用界面的全屏广告，直到用户将其关闭。 它们最适合在应用执行流程中的自然暂停位置展示，例如游戏关卡之间或是用户刚完成一项任务之后。

[<mark style="color:blue;">植入插页式广告</mark>](/copy-of-cn/jie-kou-wen-dang/ios/guang-gao-ge-shi/cha-ping-guang-gao.md)

### 原生

<div align="left"><figure><img src="/files/sWBs4apEXpy910elXTOt" alt=""><figcaption></figcaption></figure></div>

与您的应用外观和风格相符的可定制广告。您可以决定这类广告的投放方式和位置，从而使布局与应用的设计更加一致。

[<mark style="color:blue;">植入原生广告</mark>](/copy-of-cn/jie-kou-wen-dang/ios/guang-gao-ge-shi/yuan-sheng-guang-gao.md)

### 激励

<div align="left"><figure><img src="/files/tMYgMBI9RdryrLwRrXeg" alt=""><figcaption></figcaption></figure></div>

为观看短视频和与试玩广告及问卷调查互动的用户予以奖励的广告。适合通过免费游戏用户创收。

[植入激励广告](/copy-of-cn/jie-kou-wen-dang/ios/guang-gao-ge-shi/ji-li-guang-gao.md)

## 多重

<div align="left"><figure><img src="/files/XtuXLt3yWrHh5VMI568b" alt=""><figcaption></figcaption></figure></div>

为列表或瀑布流布局定制的广告。

[植入多重广告](/copy-of-cn/jie-kou-wen-dang/ios/guang-gao-ge-shi/duo-chong-guang-gao.md)


---

# Agent Instructions: 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:

```
GET https://docs.adx3.io/copy-of-cn/jie-kou-wen-dang/ios/kai-shi/ru-men-zhi-nan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
