Skip to content
Str4tos edited this page Dec 16, 2024 · 62 revisions
Prerequisites
Target Minimum iOS 13.0
XCode 15.3+

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>
What is CAS ID?

In most cases, a CASID is the same as your app store ID.
You can find an app store ID in the URL of your app’s Apple App Store URL. For example, the URL is apps.apple.com/us/app/id123456789 then app store ID is 123456789.

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

What does the script do?

The script automatically performs the following integration steps:

  • SKAdNetwork Support
  • App Transport Security
  • Link the CAS project
  • Set User Tracking usage description
  • Set Google Ads App ID
  • Set Delay app measurement

Note

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

Check the additional features of the script by running the command:

ruby casconfig.rb --help

The source code for the script can be found in the repository here.

Tip

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

Import the CAS framework

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.

The CAS framework are not yet available on Swift Package Manager.

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

1. Open 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.

2. Add Podfile header

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

platform :ios, '13.0'
use_frameworks! :linkage => :static
$cas_version = '~> 3.9.8'

Make sure there are no other use_frameworks! line declarations in the Podfile.

Note

To receive release updates Subscribe

3. Add pods to your app's target

target 'YourProjectName' do
  # There should be `pod` on ready-made solutions and/or separate adapters.
  # pod 'CleverAdsSolutions-SDK/[Solution|Adapter]', $cas_version
end

4. Add Ads Solution

CAS is a mediation platform that requires selecting desired ad networks for monetizing your application.

You can choose one of the ready-made solutions or integrate each adapter separately. Such solutions do not require you to add each network adapter separately.

If you already know what to expect from ad networks and are ready to select the set of adapters yourself, after completing the steps on this page, please refer to the Advanced Integration page. Or consult your account manager for assistance.

Add one of the following lines of the standard Clever Ads Solution to your apps's target in Podfile.

An Optimal Ads Solution

Contains a number of stable ads networks that are recommended for use in most applications:
Google Ads, Unity Ads, IronSource, LiftoffMonetize, InMobi, Yandex Ads, Mintegral, Pangle, Chartboost, DTExchange, AppLovin, AudienceNetwork, Bigo, CASExchange.

pod 'CleverAdsSolutions-SDK/Optimal', $cas_version

A Families Ads Solution

Designed for applications tagged at a children's audience and fully compatible with the Children’s Online Privacy Protection Act (COPPA). Contains:
Google Ads, Unity Ads, IronSource, LiftoffMonetize, InMobi, Yandex Ads, Mintegral, Chartboost, DTExchange, Kidoz, SuperAwesome.

pod 'CleverAdsSolutions-SDK/Families', $cas_version

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

5. Check project’s build settings

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

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

Note

Read more about Cocoapods troubleshooting.

7. Open XCode Workspace

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

open <Project>.xcworkspace

🔗 Done! What’s Next?