Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Project Setup

Sebastian Markowski edited this page Aug 3, 2021 · 35 revisions

There are a few quick steps that must be taken prior to integrating AdColony ads into your application:

Step 1: Installation

Option 1: CocoaPods

The easiest way to integrate AdColony into your Xcode project is through CocoaPods. To get the latest version of our SDK, all you need to do is add the following to your project's Podfile:

pod 'AdColony'

Please see below for additional integration requirements.

Option 2: Non-CocoaPods

Integrating the AdColony SDK directly into your Xcode project requires a few tasks be completed:

  1. Add the framework to your Xcode project.
  2. Link the required dependencies.
  3. Add the necessary linker flags.
  4. Configure supported orientations.
  5. Configure App Transport Security (ATS) settings.
  6. Configure the URL schemes the AdColony SDK uses.
  7. Configure privacy controls.

Adding the Framework to Your Xcode Project

Copy AdColony.xcframework into your Xcode project and add it to all targets that will link AdColony.

Open Target > Build Settings > Architectures and confirm that your Xcode project uses Base SDK version 9.0 or greater and that it does not use the armv6 architecture.

Linking the required dependencies

Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:

  • libz.tbd
  • libsqlite3.tbd
  • AdColony.xcframework
  • AdSupport.framework
  • AudioToolbox.framework
  • AVFoundation.framework
  • CoreMedia.framework
  • CoreTelephony.framework
  • JavaScriptCore.framework
  • MessageUI.framework
  • CoreServices.framework
  • SafariServices.framework
  • Social.framework (Set to Optional)
  • StoreKit.framework (Set to Optional)
  • SystemConfiguration.framework
  • WatchConnectivity.framework (Set to Optional)
  • WebKit.framework (Set to Optional)
  • AppTrackingTransparency.framework (Set to Optional)

Adding the Necessary Linker Flags

The AdColony SDK uses class loading, so you'll need to add the following linker flag to Target > Build Settings > Linking > Other Linker Flags:

  • -ObjC
  • -fobjc-arc

Step 2: Configuring Supported Orientations

The AdColony SDK requires your app support all orientations globally. This requirement is in place because AdColony ads may be shown in any orientation, and our view controller needs your app to support that behavior. Please note that this requirement does not dictate that your app's interface support all orientations; you just have to override the global settings in your view controllers' supportedInterfaceOrientations method.

The easiest way to satisfy this requirement is by selecting all possible orientations under the General tab of your Xcode target:

Select orientations in plist

Note that, instead of selecting all possible orientations under the General tab, you can also override the application:supportedInterfaceOrientationsForWindow: method of your AppDelegate class:

/* Objective-C */

#import <AdColony/AdColony.h>

@implementation AppDelegate
/* Class body ... */

-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return UIInterfaceOrientationMaskAll;
}
/* Swift */

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
/* Class body */

    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
        return .all
    }
}

Step 3: Configuring App Transport Security (ATS)

With the release of iOS 9 Apple introduced ATS, which requires apps to make secure network connections via SSL and enforces HTTPS connections through its requirements on the SSL version, encryption cipher, and key length. At this time, AdColony highly recommends disabling ATS in your application. Please note that, while AdColony fully supports HTTPS, some of our advertisers and 3rd party ad tracking providers do not. Therefore enabling ATS may result in a reduction in fill rate.

From the options mentioned below, please choose either option for seemless ad delivery and monetization.

Option 1: Disable ATS

In order to prevent your ads (and your revenue) from being impacted by ATS, please disable it by adding the following to your info.plist:

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

Option 2: Keep ATS Enabled & Add ATS Keys

If you still wish to keep ATS enabled with the integration, please add the following keys to your info.plist file:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <false/>
    <key>NSAllowsLocalNetworking</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>

Step 4: Configuring Ad Networks

With release of iOS 11.3 Apple introduced a new way for install attribution handling. In order to enable us to use it add network IDs presented here to your Info.plist (Ad Network IDs are case-sensitive).

Step 5: Configuring URL Schemes

With the release of iOS 9, Apple also restricted usage of the canOpenURL: API, which AdColony uses to make decisions about whether or not we can land users in certain apps from our Dynamic End Cards (DECs). For example, one of our ad units could be for a new movie, and the associated DEC may present functionality to the user that allows them to send a tweet about it using the Twitter app. This kind of functionality is still possible in iOS 9, but publishers must enable it for the applications AdColony links to by authorizing each app’s URL scheme in their plist. Note that if the schemes are not added, users will be taken to the app’s website instead, which may result in an undesirable user experience - having to login to the site, for example. In order to enable deep-linking for the apps the AdColony SDK uses, please add the following entry to your app's plist:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fb</string>
    <string>instagram</string>
    <string>tumblr</string>
    <string>twitter</string>
</array>

Step 6: Configuring Privacy Controls (Optional)

In iOS 10, Apple has extended the scope of its privacy controls by restricting access to features like the camera, photo library, etc. In order to unlock rich, immersive experiences in the SDK that take advantage of these services, please add the following entry to your apps plist:

<key>NSPhotoLibraryUsageDescription</key>
<string>Some ad content may require access to the photo library.</string>
<key>NSCameraUsageDescription</key>
<string>Some ad content may access camera to take picture.</string>
<key>NSMotionUsageDescription</key>
<string>Some ad content may require access to accelerometer for interactive ad experience.</string>

Step 7: Gather Information From Your AdColony Account

Log in to the AdColony Dashboard and create an app and desired zones on the website by following the instructions provided there (please refer to "Setting up Apps and Zones" for help). Then retrieve your app ID and your corresponding zone IDs for integration (see Showing Interstitial Ads).