> For the complete documentation index, see [llms.txt](https://intowow.gitbook.io/crystalexpress-documentation-v3-x/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://intowow.gitbook.io/crystalexpress-documentation-v3-x/mediation-guidelines/mediating-intowow/admob/ios.md).

# iOS

The CrystalExpress AdMob Custom Event allows AdMob publishers to add CrystalExpress as a Custom Ad Network within the AdMob platform.

CrystalExpress provides four ad formats for AdMob mediation. The relationship between AdMob ad unit and ad format in CrystalExpress is as following:

| AdMob ad unit   | AD format from CrystalExpress |
| --------------- | ----------------------------- |
| Banner          | Card AD                       |
| Rewarded Video  | Rewarded Video AD             |
| Interstitial    | Splash AD                     |
| Native Advanced | Native AD (image only)        |

**NOTICE: The aspect ratio for CrystalExpress ad is 16:9, 4:3 or 1:1.**

Before adding CrystalExpress as Custom network, you have to integrate AdMob SDK by following the instructions on the [AdMob website](https://developers.google.com/admob/ios/quick-start).

**NECESSARY STEPS:**

* Get CrystalExpress SDK and Crystal ID.
* Integrate the CrystalExpress SDK.
* Add CrystalExpress AdMob Custom Event into project.
* Configure AdMob to mediate CrystalExpress.

## Get CrystalExpress SDK and Crystal ID

Please contact your Intowow account manager. We will provide the appropriate version of SDK and Crystal ID to fit your needs.

## Integrate the CrystalExpress SDK.

### Step 1

Unzip the SDK package, and you could find static library, header files, and sample app.

### Step 2

Add `ce-[premium|lite]-[global|cn]-[version].a` to your project via **Build Phases** -> **Link Binary With Libraries** in the project setting of Xcode.

### Step 3

Add header files to project.

### Step 4

Make sure all of the following frameworks are added into Build Phases.

* Security.framework
* CFNetwork.framework
* MessageUI.framework
* MobileCoreServices.framework
* SystemConfiguration.framework
* AdSupport.framework
* libz.dylib
* libc++.dylib
* CoreTelephony.framework
* CoreMedia.framework
* libsqlite3.dylib
* AVFoundation.framework
* libicucore.dylib

### Step 5

Add `-ObjC` flag in **TARGETS** -> **Build Settings** -> **Linking** -> **Other Linker Flags**.

### Step 6

Copy `CrystalExpress.plist` to your project and set the Crystal\_Id value to Crystal ID you received from Intowow account manager.

### Step 7

Import `I2WAPI.h` in `AppDelegate.m`.\
Initialize SDK in `application:didFinishLaunchingWithOptions:` of `AppDelegate.m`:

```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // init SDK
    [I2WAPI initWithVerboseLog:NO isTestMode:NO];
    return YES;
}
```

* Enable/disable debugging message from SDK with `initWithVerboseLog:(BOOL)`.
* Set SDK to test mode by `isTestMode:(BOOL)` for development.

### Step 8

iOS 9 and later versions block http connection by default. Since most of the redirect links of ads use HTTP protocol, we have to modify `Info.plist` in your project to allow HTTP connections.

```markup
<key>NSAppTransportSecurity</key>
<dict>
     <key>NSAllowsArbitraryLoads</key>
     <true/>
</dict>
```

## Add CrystalExpress AdMob Custom Event into project

### Step 1

Contact Intowow account manager for CrystalExpress AdMob Custom Event and sample code.

### Step 2

Unzip `ce-[premium|lite]-global-custom-event-SDKversion.zip`, and add files under `AdMobDemo/CrystalExpress_Google_CustomEvent/` to your project according to following different propose.

* For Banner:

  `Banner/CECustomEventCard.h`

  `Banner/CECustomEventCard.m`

  `Common/UIView+CELayoutAdditions.h`

  `Common/UIView+CELayoutAdditions.m`
* For Native Advanced:\
  (For now, we only support native image ad)

  `NativeAdvanced/CECustomEventNativeAdvanced.h`

  `NativeAdvanced/CECustomEventNativeAdvanced.m`

  `NativeAdvanced/CEMediatedNativeAppInstallAd.h`

  `NativeAdvanced/CEMediatedNativeAppInstallAd.m`
* For Rewarded Video:

  `RewardedVideo/CEMediationAdapterRewardedVideo.h`\
  `RewardedVideo/CEMediationAdapterRewardedVideo.m`
* For Interstitial:\
  `Interstitial/CECustomEventInterstitial.h`\
  `Interstitial/CECustomEventInterstitial.m`

For further integration issues, please check the sample code within download folder.

## Configure AdMob to mediate CrystalExpress

### Step 1

Log in to your AdMob account and register your application on your account dashboard.

If you have set up a Mediation Group, please click the Mediation Group and skip **Step 1**.\
1\. Click **Mediation** in the side bar and **Create Mediation Group.**<br>

![](/files/-LGU_vgoed6ttGBroCwD)

2.Select targeted **ad format(Banner / Rewarded Video)** and **Platform,** and click **CONTINUE.**&#x20;

![](/files/-LGU_vgrEsXJQ2LXnkis)

3.Set up **Name** and **Ad units** to mediation group

{% hint style="warning" %}
**NECESSARY**: Please prepare at least **1** ad unit. Otherwise, you would be block here and Ad sources could not be set.
{% endhint %}

![](/files/-LGU_vh3cMfwKpkT0qU-)

### Step 2

Click **ADD CUSTOM EVENT** in the ad sources table

![](/files/-LGU_vh5xmmBLQAp-GTO)

### Step 3

1.Please set up the name(**Label**) and **eCPM** for your Custom Event, and click **CONTINUE**.<br>

![](/files/-LGU_vgxkcU2Bn2uYCfn)

2.Add Custom Event **Class Name** for iOS:

* Banner ad: Please enter `CECustomEventCard`
* Interstitial ad: Please enter `CECustomEventInterstitial`
* Rewarded Video ad: Please enter `CEMediationAdapterRewardedVideo`   &#x20;
* Native advanced ad: Please enter `CECustomEventNativeAdvanced`

3.Add **Parameter** for iOS:

* Add **Parameter** for Android:
  * **ATTENTION**: Please **ignore** the optional notation for Parameter on **Configure ad units panel**. To request ad from intowow successfully, **Parameter is a must!**
    * Banner ad: Please contact intowow account manager for it.
    * Rewarded Video ad: Please contact intowow account manager for it

1.Click **DONE.**

![](/files/-LGU_vh1U5pnYDDWbwbT)

2.Click **Save**.

![](/files/-LGU_vh37kwdm9EMfbTA)

### Step 4

Request ad as the instructions for [Banner Integration](https://developers.google.com/admob/ios/banner), [Interstitial Integration](https://developers.google.com/admob/ios/custom-events), [Rewarded Video Integration](https://developers.google.com/admob/ios/rewarded-video), [Native Advanced Integration](https://developers.google.com/admob/ios/native-custom-events) from AdMob.

## The Layout of CrystalExpress AD

In AdMob Custom Event, our SDK will keep the aspect ratio of creatives and try to fit the ad view that you bind to AdMob.

If the aspect ratio for the ad view to be bound and the creative are inconsistent, the return ad will be filled with black background to match the aspect ratio.

![](/files/-LGU_veOymtzx0Z3gbFR)


---

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

```
GET https://intowow.gitbook.io/crystalexpress-documentation-v3-x/mediation-guidelines/mediating-intowow/admob/ios.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.
