iOS MoPub SDK Native Ads Support

546 views 2018-05-10 Ofer Garnett 0



The purpose of this to document is to describe the steps needed in order to add YouAppi native ads support via MoPub iOS SDK.


  • YouAppi’s Partner access token. The app access token is a unique identifier that is used by YouAppi to identify your app.
  • YouAppi-MoPub native ads Zip file. The Zip file is an iOS Framework allowing to show YouAppi’s demand using MoPub SDK.
  • MoPub SDK.


  • Make sure MoPub SDK is added to your app. Instructions can be found at:

  • Add YouAppi’s framework to your project, by dragging the folder: YouAppiMoPubNative.framework from the downloaded ZIP file to your app frameworks folder on XCode.

  • On XCode under the target of your app, make sure that the framework is added to both: Embedded Binaries and Linked Frameworks and Libraries.


  • Change to YES inside the build settings under the option ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES.
  • Change to YES inside the build settings under the option DEFINES_MODULE.
  • On your app target, to to: Build Phases and add a Run Script. Past the following code to the Run Script:

    # This script loops through the frameworks embedded in the application and
    # removes unused architectures.
    find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
    FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
    echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
    for ARCH in $ARCHS
    echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
    echo "Merging extracted architectures: ${ARCHS}"
    lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
    rm "${EXTRACTED_ARCHS[@]}"
    echo "Replacing original executable with thinned version"
    It should look like:
  • On MoPub platform on Networks tab, add a new network for YouAppi:
  • On the popup that opens choose to add a Custom Native Network.
  • Name your new network (YouAppi might be a good name) and fill other relevant details.
  • On field CUSTOM EVENT CLASS enter the value: YouAppiNativeCustomEvent. It should look like:
  • Set your access token and ad unit id on field CUSTOM EVENT CLASS DATA. The value should look like: {“accessToken”: “e700f511-0e76-455c-bd0e-aaaaaaaaaaaa”, “adUnitId”: “your ad unit id”}. The access token is the partner access token you received from YouAppi. The ad unit id can be your MoPub ad unit ID or any other arbitrary name you would like to give to this placement.
  • Make sure to add YouAppi network as a source to your order/line item.


  • Load your app section that contains native ads, and make sure you get native ads from YouAppi network.