> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudx.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration

> Meta Audience Network adapter for CloudX iOS SDK. Supports Banner, MREC, Interstitial, Rewarded, and Native.

For CloudX dashboard mapping and Meta-side ID setup, see the [Meta Audience Network bidder guide](/en/networks/meta-audience-network). This page covers iOS-specific integration details only.

## Installation

### CocoaPods

```ruby Podfile theme={null}
pod 'CloudXMetaAdapter', '~> 6.21.1.0'
```

```bash theme={null}
pod install --repo-update
```

### Manual

1. Download `CloudXMetaAdapter.xcframework.zip` from [Releases](https://github.com/cloudx-io/cloudx-ios/releases)
2. Unzip and drag `CloudXMetaAdapter.xcframework` into your Xcode project
3. Add `FBAudienceNetwork` (`= 6.21.1`) manually.

## Info.plist Configuration

### SKAdNetwork IDs (Required for iOS 14.5+)

Both Meta SKAdNetwork IDs are required for Meta to make bids:

```xml Info.plist theme={null}
<key>SKAdNetworkItems</key>
<array>
    <dict>
        <key>SKAdNetworkIdentifier</key>
        <string>v9wttpbfk9.skadnetwork</string>
    </dict>
    <dict>
        <key>SKAdNetworkIdentifier</key>
        <string>n38lu8286q.skadnetwork</string>
    </dict>
</array>
```

### App Tracking Transparency (iOS 14+)

```xml Info.plist theme={null}
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
```

## Project Configuration

**Linker Flags:** Add `-ObjC` to Other Linker Flags in Build Settings.

**Bitcode:** Meta SDK does not support Bitcode. Set Enable Bitcode to `NO`.

## Meta SDK 6.21.0 SceneDelegate Crash

<Warning>
  Meta Audience Network SDK 6.21.0 has an internal bug that causes crashes when used in apps with `SceneDelegate` (iOS 13+ scene-based lifecycle).
</Warning>

### The Problem

The crash occurs during banner ad display with the following error:

```
*** -[NSProxy doesNotRecognizeSelector:observeScreenOrientationChanges:] called!
```

This is an **internal Meta SDK bug** where their `FBDisplayAdController` creates an `NSProxy` for orientation observation that isn't properly configured.

### Solution: Remove SceneDelegate

The **only reliable fix** is to use the old-style `AppDelegate`-only pattern (without `SceneDelegate`).

#### Step 1: Remove SceneDelegate files

Delete `SceneDelegate.h` and `SceneDelegate.m` from your project.

#### Step 2: Remove UIApplicationSceneManifest from Info.plist

Remove the entire `UIApplicationSceneManifest` section from your `Info.plist`.

#### Step 3: Add required keys to Info.plist

```xml Info.plist theme={null}
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
```

#### Step 4: Update AppDelegate

<CodeGroup>
  ```objc Objective-C theme={null}
  // AppDelegate.h
  @interface AppDelegate : UIResponder <UIApplicationDelegate>
  @property (strong, nonatomic) UIWindow *window;
  @end

  // AppDelegate.m
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
      self.window.rootViewController = [[YourRootViewController alloc] init];
      [self.window makeKeyAndVisible];
      return YES;
  }
  ```

  ```swift Swift theme={null}
  class AppDelegate: UIResponder, UIApplicationDelegate {
      var window: UIWindow?

      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
          window = UIWindow(frame: UIScreen.main.bounds)
          window?.rootViewController = YourRootViewController()
          window?.makeKeyAndVisible()
          return true
      }
  }
  ```
</CodeGroup>

### Xcode Warning

After removing SceneDelegate, you'll see this warning:

```
CLIENT OF UIKIT REQUIRES UPDATE: This process does not adopt UIScene lifecycle.
```

This warning is **expected** and does not affect functionality.

## Compatibility

| Adapter version | Network SDK                    | Minimum CloudXCore |
| --------------- | ------------------------------ | ------------------ |
| `6.21.1.0`      | Meta Audience Network `6.21.1` | `3.5.0`            |

The adapter is discovered automatically when your server-provisioned CloudX configuration includes this network's demand. No manual adapter registration is required.

## Support

For support, contact [mobile@cloudx.io](mailto:mobile@cloudx.io)
