Manually configure project - cleveradssolutions/CAS-iOS GitHub Wiki

Note

We have created a script that performs all the steps below automatically for you. Learn how to invoke automatic configuration on the Project Setup page.

SKAdNetwork Support

iOS versions 14+ require that you include the SKAdNetworkIdentifier for all of mediated ad networks in the Info.plist. For more information, see "SKAdNetwork: Configuring the Participating Apps" in Apple’s StoreKit Developer documentation.

  1. An up-to-date list of SKAdNetwork partners can be found in the repository: SKAdNetworkItems.xml
  2. Copy the <key>SKAdNetworkItems</key><array>...</array> tags from the SKAdNetworkItems.xml.
  3. Open Info.plist file as Source Code.
  4. Paste the content at the end of the file before </dict></plist>

🌟 Last updated: SKAdNetworksID
Additional SKAdNetworkIdentifier values may be added in the future. We recommend checking back on this page for updates.

App Transport Security

App Transport Security (ATS) is a privacy feature introduced in iOS 9. It's enabled by default for new apps and enforces secure connections.
To ensure your ads are not impacted by ATS, add the NSAllowsArbitraryLoads exception to disable ATS restrictions:

Key Type Value
Information Property List Dictionary
▼ App Transport Security Settings Dictionary
- Allow Arbitrary Loads Boolean YES

Or, open plist as source code:

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

Note

Make sure that your info.plist does not contain any other exceptions besides NSAllowsArbitraryLoads, as this might create a conflict.

Link the project

To link your project with the mediation settings, you need to have a registered account and an application in the CAS system.

Note

If you haven't created an CAS account and registered the app yet, now's a great time to do so.
If you just want to experiment or test the SDK, you can skip link your project.

  1. Sign In https://cleveradssolutions.com.
  2. Select the Applications section on the right panel.
  3. Click the plus(+) button and follow the instructions on the form. It may take up to 30 minutes to register the app in the CAS system.
  4. After the registration completed, click the Action button in the row of your application

image

Add a CAS configuration file

CAS uses a mediation configuration caching system to handle unexpected situations.

  1. Click Download CAS settings button.
  2. A cas_settings[settings_id].json file will be downloaded.
  3. Move your config file into the root of your Xcode project.
  4. If prompted, select to add the config file to all targets.

What do you need to know about this config file?

  • The CAS config file contains unique, but non-secret identifiers for your project.
  • The configuration file is updated frequently, so we recommend that you regularly download the latest file for each new release.
  • Please do not change the name of the file. Make sure the config file name is not appended with additional characters, like (2).
  • The [settings_id] is the internal unique identifier of the resource.
  • If you have multiple CAS manager IDs in your project, you must associate each CAS ID with a registered app in the CAS console so that each app can have its own cas_settings[settings_id].json file.

Add Google Ads App ID

CAS assigns a new AdMob App ID for your application to the correct operation of all features.

Important

You cannot use your own identifier and must replace it with a new one generated by CAS system.

You can find your Admob App ID in the CAS UI:
image

  1. Click the Show AdMob App ID button.
  2. Copy the id from the form.
  3. Add a GADApplicationIdentifier key to your app's Info.plist file.
  4. Insert AdMob app ID to <string>, as shown below.
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~1458002511 -->
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy</string>

Or, edit it in the property list editor:

Key Type Value
Information Property List Dictionary
▼ GADApplicationIdentifier String ca-app-pub-3940256099942544~145800251

Note that failure to add the GADApplicationIdentifier key as shown above results in a crash with the message:

The Google Mobile Ads SDK was initialized incorrectly.

Delay app measurement

By default, the Google Mobile Ads SDK initializes app measurement and begins sending user-level event data to Google immediately when the app starts. This initialization behavior ensures you can enable AdMob user metrics without making additional code changes.

However, if your app requires user consent before these events can be sent, you can delay app measurement until CAS explicitly initialize the Google Mobile Ads SDK.

To delay app measurement, add the GADDelayAppMeasurementInit key with a boolean value of YES to your app’s Info.plist. You can make this change programmatically:

<key>GADDelayAppMeasurementInit</key>
<true/>

Or, edit it in the property list editor:

Key Type Value
Information Property List Dictionary
▼ GADDelayAppMeasurementInit Boolean YES
⚠️ **GitHub.com Fallback** ⚠️