将 MoPub 与 swift 集成



在我的pod文件中,我有

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'Penguin Rush' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  # Pods for Penguin Rush
  pod 'mopub-ios-sdk'
  target 'Penguin RushTests' do
    inherit! :search_paths
    # Pods for testing
  end

正如你所注意到的,我正在做use_frameworks!

我还创建了一个桥接标头,我不应该这样做,但我仍然无法找到 SDK。

在我的构建设置下,我将Objective-C桥接标头指向Penguin Rush/PenguinRush-BridgingHeader.h

我还将框架搜索路径指向"Pods/**"

我在这里错过了什么?

Swift 4.2 通过导入 mopub 使用 mopub sdk

导入 MoPub

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    let sdkConfig = MPMoPubConfiguration(adUnitIdForAppInitialization: "Your ad unit id")
    MoPub.sharedInstance().initializeSdk(with: sdkConfig) {
    }
    return true
}

Neverminderino。

我遵循了本指南:

http://onebigfunction.com/ios/2015/12/31/mopub-mo-problems/

我只是保留了自己的桥接标头,在构建设置中将我的 Obj-C 桥接标头指向该标头并调用它完成。

最新更新