跳转到主要内容

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.

有关 CloudX 控制台映射和 Meta 侧 ID 设置,请参阅 Meta Audience Network 竞价方指南。本页仅说明 iOS 特定的集成细节。

安装

CocoaPods

Podfile
pod 'CloudXMetaAdapter', '~> 3.4.0'
pod install --repo-update

手动安装

  1. Releases 下载 CloudXMetaAdapter-v{version}.xcframework.zip
  2. 解压并将 CloudXMetaAdapter.xcframework 拖入您的 Xcode 项目
  3. 手动添加 FBAudienceNetwork>= 6.15.1< 7.0)。

Info.plist 配置

SKAdNetwork IDs(iOS 14.5+ 必需)

Meta 进行竞价需要两个 Meta SKAdNetwork ID:
Info.plist
<key>SKAdNetworkItems</key>
<array>
    <dict>
        <key>SKAdNetworkIdentifier</key>
        <string>v9wttpbfk9.skadnetwork</string>
    </dict>
    <dict>
        <key>SKAdNetworkIdentifier</key>
        <string>n38lu8286q.skadnetwork</string>
    </dict>
</array>

应用追踪透明度(iOS 14+)

Info.plist
<key>NSUserTrackingUsageDescription</key>
<string>此标识符将用于向您投放个性化广告。</string>

项目配置

链接器标志: 在 Build Settings 中将 -ObjC 添加到 Other Linker Flags。 Bitcode: Meta SDK 不支持 Bitcode。将 Enable Bitcode 设置为 NO

Meta SDK 6.21.0 SceneDelegate 崩溃问题

Meta Audience Network SDK 6.21.0 存在一个内部 bug,在使用 SceneDelegate(iOS 13+ 基于场景的生命周期)的应用中会导致崩溃。

问题描述

崩溃发生在横幅广告展示期间,错误信息如下:
*** -[NSProxy doesNotRecognizeSelector:observeScreenOrientationChanges:] called!
这是一个 Meta SDK 内部 bug,其 FBDisplayAdController 创建的 NSProxy 未正确配置方向观察。

解决方案:移除 SceneDelegate

唯一可靠的修复方案是使用旧式的仅 AppDelegate 模式(不使用 SceneDelegate)。

步骤 1:移除 SceneDelegate 文件

从项目中删除 SceneDelegate.hSceneDelegate.m

步骤 2:从 Info.plist 中移除 UIApplicationSceneManifest

Info.plist 中移除整个 UIApplicationSceneManifest 部分。

步骤 3:向 Info.plist 添加必需的键

Info.plist
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>

步骤 4:更新 AppDelegate

// 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;
}

Xcode 警告

移除 SceneDelegate 后,您会看到以下警告:
CLIENT OF UIKIT REQUIRES UPDATE: This process does not adopt UIScene lifecycle.
此警告是预期行为,不会影响功能。

支持

如需支持,请联系 mobile@cloudx.io