Caching

To learn about ad caching on iOS see our how to integrate page.
Preload ads on your users’ devices to boost their experience! Ads will load faster when requested, and you can verify that an ad is available before displaying it.
Use the following methods to cache ads so they can be displayed later. We use CBLocationHomeScreen as our example named location.

Copied to clipboard

PRO TIP: Use these methods to check if an ad has been preloaded before you try to show it. If an ad isn’t already cached, you should probably cache one!

Copied to clipboard

Optional: You also can receive notification from the SDK when an ad is successfully cached by implementing these delegate methods.

Copied to clipboard

If the cache calls fails, a didFailToLoadInterstitial delegate method will fire. This delegate also fires if you call showInterstitial and an ad fails to display. Do NOT make cache or show calls inside didFailToLoad delegates or the universe will implode.

Copied to clipboard
▲ Back to top

PRO TIP: Chartboost SDKs automatically cache ads after they’ve been successfully displayed at a named location. However, it’s best practice to also manually cache ads at bootup or other relevant points in your app before you need to display them.
Autocaching will not cause unnecessary network requests. Any cache calls will only send network requests if the cache is empty at a specific location.

Use the following SDK methods to toggle autocaching.

Copied to clipboard
▲ Back to top

  • [Chartboost showInterstitial:CBLocationHomeScreen]; displays a cached interstitial if one exists. Otherwise, it will request one from the server.
  • We recommend caching for optimal performance and user experience; however, it’s always a good idea to be conscious of your users’ data usage.
  • Cached interstitials automatically expire after 24 hours.
  • Cache requests are asynchronous. Keep this in mind if you cache many interstitials while loading other data for your app.
▲ Back to top

You might also like…
  • Named locations: Show different ad campaigns at different points in your game and fine-tune your campaigns’ behavior from your dashboard.


Last Updated on April 8, 2021