Project Setup

Prerequisites

  • Xcode 8 or higher
  • Deployment target of 8.0 or higher

Download MPS SDK Examples

1.1 Create a New Project

Open Xcode.
Navigate to File > New > Project…
Select Single View Application under iOS Applications, and click Next.

Step_0

Give your project the desired Product Name. For the purposes of this example we will call it ReferenceTestApp.
Enter your Organization Name and Identifier.
Choose either Swift or Objective-C for the Language. We will use Swift for this demo.
Click Next.

Step_1

Finally create save the project in your desired location.

1.2 Add SDK to Your Project and Instantiate

Copy the provided nbcu_mps_ios_sdk.framework and GoogleMobileAds.framework to your project, and make sure the Copy items if needed and Add to targets options are enabled. Also add the AdSupport.framework to your projects Linked Frameworks and Libraries section.

Step_2

If you see a message about updating the Google Mobile Ads SDK, please contact the MPS SDK Support team prior to updating.
Email: mps-sdk-support@nbcuni.com, DPIM Slack channel: #mps_sdk_support

1.3 Add SDK to Embedded Framework

Add the nbcu_mps_ios_sdk.framework to the Embedded Binaries section of your project.

Step_3

1.4 Update App Transport Security in iOS 9

Google Mobile Ads SDK requires adding the NSAllowsArbitraryLoads exception to make sure your ads are not impacted by App Transport Security (ATS) on iOS 9 devices.
For iOS 10 devices, NSAllowsArbitraryLoadsForMedia and NSAllowsArbitraryLoadsInWebContent are required to make sure your ads are not impacted by ATS.

Add these values to the info.plist file of your application.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Reference: Google ATS details.

1.5 Objective-C Project Settings

For Objective-C projects you should enable swift libraries.

Framework search path

1.6 Update Simulator Scheme Environment Variables (optional)

If you want to disable system log messages, you can optionally add OS_ACTIVITY_MODE=disable to the Environment Variables under Arguments of the scheme.

Notifications

1.7 App Store Submission

Because the SDK is FAT Binary and works for simulators and devices you need to update it before App Store submission.

chmod u+x app-store-submission.sh

And add app-store-submission.sh file to run phases with

"$SRCROOT/PATH_TO_FILE/app-store-submission.sh"

Notifications