CAS.AI iOS Framework

Integrating CAS SDK into an app is the first step toward displaying ads and earning revenue. Once you've integrated and initialized the SDK, you can choose an ad format and follow the steps to implement it.

App prerequisites

  • Use Xcode 16.2 or higher
  • Target minimum iOS 13.0 or higher

Automatically configure project

Your project requires additional configurations that can be performed automatically by a special script.

  1. Download the casconfig.rb
  2. Place the script in directory with the app .xcodeproj
  3. Open the terminal window and run command:
cd into/your/project/folder
  1. Run ruby script:
ruby casconfig.rb <CAS_ID>

For more details about the script and its updates, please refer to the the CAS iOS repository.

Repeat the script before every update of the application to make sure you are using up-to-date configurations.

Instead of using the casconfig.rb script, you can manually complete additional steps to configure your project. (Not recomended)

CocoaPods

Follow these steps to integrate CAS.AI framework with CocoaPods. CocoaPods is a dependency manager for Objective-C and Swift; it automates and simplifies the SDK integration process.

Open your project's Podfile

The Podfile is a specification that describes the dependencies of the targets of one or more Xcode projects. You could use a pod init command to create the Podfile with smart defaults.

Add CAS pods source url to the beginning of the file:

source 'https://github.com/cleveradssolutions/CAS-Specs.git'

Use pods as frameworks

use_frameworks!

Mediated Networks

CAS.AI SDK offers three integration paths. Choose one based on your app’s target audience. If you're unsure which solution best fits your application, please contact your account manager.

Add one of the following lines of Clever Ads Solutions to your apps's target build configuration.

Subscribe

Subscribe to receive notifications about CAS updates.

Optimal Ads Solution

Recommended for most applications targeting a general or mixed audience. Includes a broad set of stable, high-performance networks:
Google Ads, Unity Ads, IronSource, LiftoffMonetize, InMobi, Yandex Ads, Mintegral, Pangle, Chartboost, DTExchange, AppLovin, AudienceNetwork, Bigo, CASExchange.

pod 'CleverAdsSolutions-SDK/Optimal', '4.3.0'

A Families Ads Solution

Required for applications directed exclusively at children and fully compatible with the Children’s Online Privacy Protection Act (COPPA). Networks included:
Google Ads, Unity Ads, IronSource, LiftoffMonetize, InMobi, Yandex Ads, Mintegral, Chartboost, DTExchange, Kidoz.

pod 'CleverAdsSolutions-SDK/Families', '4.3.0'

The families ads solution is NOT intended for apps in Apple Kids Category.

Choice networks

Advanced publishers who are familiar with ad network integrations can choose their own set of adapters. If you have any questions or need assistance, please contact your account manager.

When you are not using the solution pods, you must add a CleverAdsSolutions-Base pod for the CAS base framework.

pod 'CleverAdsSolutions-Base', '4.3.0'

Follow the instructions on the Mediated Networks page.

Check project’s build settings

  • Open Xcode <Project>.xcodeproj
  • Go to the Build Settings section for the app target
  • Find the OTHER_LDFLAGS property, if customized.
  • Make sure the $(inherited) flag is at the beginning of the list.

Install pods to the project

Open the terminal window and run:

cd into/your/project/folder

Run pod install with repo update:

pod update

Make sure that after Pod installation complete in the terminal, there are no issues that need to be fixed. Repeat the installation after resolving issues.

Read more about Cocoapods troubleshooting.

Open XCode Workspace

Make sure to always open the Xcode workspace instead of the project file when building your project:

open <Project>.xcworkspace

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system, automating the process of downloading, compiling, and linking dependencies.

To add CAS as a package dependency to your Xcode project:

  1. Select File > Add Package Dependency

  2. Enter the CAS Git repository URL into the Search or Enter Package URL field:

    https://github.com/cleveradssolutions/CAS-iOS
    
  3. Specify the Up to Next Minor version: 4.3.0.

  4. Click Add Package.

  5. Add each CAS adapter you want to use for monetization to your app target.

  6. Open the Build Settings for your app target.

  7. Locate the OTHER_LDFLAGS setting.

  8. Ensure that $(inherited) and the -ObjC flag are at the beginning of the list.

Please note that SPM integration does not support certain adapters due to limitations of the ad frameworks. If you need to use these adapters, consider using the CocoaPods integration instead.

Manual download

For projects where you cannot use CocoaPods during Xcode build, you need to manually collect all frameworks from the CAS Pod dependencies and add them to the project. Our script, which can be found in the repository here, will assist you with this process.

User Tracking usage description

To display the App Tracking Transparency authorization request for accessing the IDFA, update your Info.plist to add the NSUserTrackingUsageDescription key with a custom message describing your usage. Below is an example description text:

<key>NSUserTrackingUsageDescription</key>
<string>Your data will remain confidential and will only be used to provide you a better and personalised ad experience</string>

Name in Xcode Property List Editor: Privacy - Tracking Usage Description