Project Setup - cleveradssolutions/CAS-iOS Wiki

  1. Add CAS settings resources
  2. Add Google Ads App ID
  3. App Transport Security
  4. Swift Build Settings
  5. Wireless accessory
  6. URL Schemes
  7. Optional permissions
  8. App-Bound Domains

Add CAS settings resources

Add own settings file

CAS uses a mediation configuration caching system to handle unexpected situations. We recommend that you regularly update this file to improve the stability of the mediation.

  1. Follow the link
  2. Select your Manager ID (App iTunes ID) in form.
  3. Select iOS platform.
  4. Download a cas_settings[settings_id].json file.
  5. Drop settings to your project.
  6. Link the file to main resources bundle Project Settings > Build Phases > Copy Bundle Resources.

⚠️ [settings_id] must not match your real Manager Id.

Add Google Ads App ID

:star: If you don't want to use Google Ads (AdMob) then skip next step.
CAS assigns a new AdMob App ID for your application to the correct operation of all features.

⚠️ You cannot use your current identifier and must replace it with a new one generated by our system.

Add a GADApplicationIdentifier key to your app's Info.plist file.
You can find your app ID in the CAS UI:

  1. Follow the link
  2. Select your Manager ID (App iTunes ID) in form.
  3. Select iOS platform.
  4. Press Find AdMob App ID button.
  5. 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>

⭐Note: If you haven't created an CAS account and registered an app yet, now's a great time to do so. In a real app, it is important that you use your actual AdMob app ID, not the one listed above. If you're just looking to experiment with the SDK in a Hello World app, though, you can use the sample App ID shown above.

Note also that failure to add the <meta-data> tag as shown above results in a crash with the message:

The Google Mobile Ads SDK was initialized incorrectly.

App Transport Security

With the release of iOS 9 Apple introduced ATS, which requires apps to make secure network connections via SSL and enforces HTTPS connections through its requirements on the SSL version, encryption cipher, and key length. At this time, CAS highly recommends disabling ATS in your application. Please note that, while CAS fully supports HTTPS, some of our advertisers and 3rd party ad tracking providers do not. Therefore enabling ATS may result in a reduction in fill rate.

In order to prevent your ads (and your revenue) from being impacted by ATS, please disable it by adding the following to your info.plist:

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

Swift Build Settings

To support Swift for iOS versions under 12.2, in the main target of your Xcode project select File > Build Settings and set Always Embed Swift Standard Libraries to Yes.

Wireless accessory

Apple has introduced privacy settings to access WiFi details from iOS 12 onwards. To boost monetization and relevant user experience, we encourage sharing WiFi details for targeted advertising.

  1. Log into you Apple developer account at https://developer.apple.com, and enable Wireless Accessory Configuration for the App ID
  2. Go to Project Settings > Select Your App Target > Signing & Capabilities tab.
  3. Add capabilities bt clicking the "+" button and select Wireless Accessory Configuration.

URL Schemes

With the release of iOS 9, Apple also restricted usage of the canOpenURL: API, which CAS mediation networks uses to make decisions about whether or not we can land users in certain apps from our Dynamic End Cards (DECs).

For example, one of our ad units could be for a new movie, and the associated DEC may present functionality to the user that allows them to send a tweet about it using the Twitter app.
Note that if the schemes are not added, users will be taken to the app’s website instead, which may result in an undesirable user experience - having to login to the site, for example.
In order to enable deep-linking for the apps the CAS uses, please add the following entry to your app's plist:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fb</string>
    <string>instagram</string>
    <string>tumblr</string>
    <string>twitter</string>
</array>

Optional permissions

In iOS 10, Apple has extended the scope of its privacy controls by restricting access to features like the camera, photo library, etc. In order to unlock rich, immersive experiences in the SDK that take advantage of these services, please add the following entry to your apps plist:

<key>NSPhotoLibraryUsageDescription</key>
<string>Some ad content may require access to the photo library.</string>
<key>NSCameraUsageDescription</key>
<string>Some ad content may access camera to take picture.</string>
<key>NSMotionUsageDescription</key>
<string>Some ad content may require access to accelerometer for interactive ad experience.</string>

App-Bound Domains

In June 2020, Apple introduced App-Bound Domains as an opt-in feature for developers to limit the domains for all WKWebView in an app to 10 or fewer, through the WKAppBoundDomains Info.plist key.

⚠️ Currently, the CAS SDK doesn't support this feature.

If you add the WKAppBoundDomains key to your Info.plist file, the CAS SDK may fail to load ads.


What’s Next?