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 26.0 or higher
  • Target minimum iOS 13.0 or higher
Subscribe
Subscribe

Subscribe to receive notifications about CAS updates.

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:

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

Use pods as frameworks

ruby
use_frameworks!

Choose Mediated Networks

Choose an integration path based on your app's target audience. If you're unsure which solution best fits your application, please contact your account manager.

Recommended for most applications targeting a general or mixed audience. Includes a broad set of stable, high-performance networks.

ruby
pod 'CleverAdsSolutions-SDK/Optimal', '4.7.4'

Networks included: Google Ads, Unity Ads, IronSource, LiftoffMonetize, InMobi, Yango Ads, Mintegral, Pangle, DTExchange, AppLovin, AudienceNetwork, Bigo, CASExchange, Maticoo, YSONetwork, Monetrix

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:

sh
cd into/your/project/folder

Run pod install with repo update:

sh
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.

Open XCode Workspace

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

sh
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

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

text
https://github.com/cleveradssolutions/CAS-iOS
  1. Specify the Up to Next Minor version: 4.7.4.
  1. Click Add Package.
  1. Add each CAS adapter you want to use for monetization to your app target.
  1. Open the Build Settings for your app target.
  1. Locate the OTHER_LDFLAGS setting.
  1. Ensure that $(inherited) and the -ObjC flag are at the beginning of the list.

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.

Configure Info.plist

Your project Info.plist 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:
text
cd into/your/project/folder
  1. Run ruby script:
text
ruby casconfig.rb <CAS_ID>

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

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:

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