将MoPub与cocoapods集成 - 快速

时间:2016-07-07 07:46:47

标签: swift cocoapods

在我的podfile中我有

# 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 Bridging Header指向Penguin Rush / PenguinRush-BridgingHeader.h

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

我在这里缺少什么?

2 个答案:

答案 0 :(得分:1)

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
}

答案 1 :(得分:0)

Neverminderino。

我遵循了这个指南:

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

我只是保留了自己的桥接标题,将构建设置中的Obj-C桥接标题指向该标题并将其命名为完成。