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.0or higher - Target minimum iOS
13.0or higher
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:
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/cleveradssolutions/CAS-Specs.git'
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.
Check project’s build settings
- Open Xcode
<Project>.xcodeproj - Go to the Build Settings section for the app target
- Find the
OTHER_LDFLAGSproperty, 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:
-
Select File > Add Package Dependency
-
Enter the CAS Git repository URL into the Search or Enter Package URL field:
https://github.com/cleveradssolutions/CAS-iOS -
Specify the Up to Next Minor version:
4.6.3. -
Click Add Package.
-
Add each CAS adapter you want to use for monetization to your app target.
-
Open the Build Settings for your app target.
-
Locate the
OTHER_LDFLAGSsetting. -
Ensure that
$(inherited)and the-ObjCflag 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.
Configure Info.plist
Your project Info.plist requires additional configurations that can be performed automatically by a special script.
- Download the casconfig.rb
- Place the script in directory with the app
.xcodeproj - Open the terminal window and run command:
cd into/your/project/folder
- 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)
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