Download & Integrate the Chartboost SDK for iOS

Last Update:

 

Add your mobile game to the Chartboost network with just 10 lines of code!

 


 

What's in the box? Our SDK package comes fully loaded with features.

High-quality video ads specially tailored for games to reward your players!

Customizable interstitials that give your players a seamless in-game experience!

A robust analytics suite to target your best possible audience!

View full SDK release notes ▶

 


 

Ready to integrate the Chartboost SDK? Let's do this!

 

 


 

Before you begin:

  • Have you signed up for a Chartboost account?
  • Did you add an app to your dashboard?
  • Did you download the latest SDK?
  • Do you have an active publishing campaign?
  • Apps must be compiled with iOS base SDK v6.0 or higher.
  • As of June 1, 2016, Apple requires that all submitted apps support IPv6.
  • The Chartboost SDK runs only on devices with iOS version 6.0 or higher, iPhone 3GS or later, iPod 3rd generation or later, and iPad 2nd generation or later.
  • startWithAppId:appSignature:delegate: must always be called during hard and soft bootups, no matter what other actions your app is taking.

 


 

Unzip the SDK package and drop Chartboost.framework into your Xcode project.

PRO TIP: Checkmark the Copy items if needed option. This creates a local copy of the framework for your project, which keeps your project organized.  

 

Link the StoreKit, Foundation, CoreGraphics, and UIKit frameworks.

 


 

Add the import header #import <Chartboost/Chartboost.h> to your
AppDelegate.m file.

 


 

Initialize Chartboost in your didFinishLaunchingWithOptions method.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions       
{
    // Initialize the Chartboost library
    [Chartboost startWithAppId:@"YOUR_CHARTBOOST_APP_ID" 
                  appSignature:@"YOUR_CHARTBOOST_APP_SIGNATURE" 
                      delegate:self];                     
    return YES;
}

 

startWithAppId:appSignature:delegate: must always be called during hard and soft bootups, no matter what other actions your app is taking.
You might receive a warning when passing an object as a delegate into the startWithAppID:appSignature:delegate: method. You can usually ignore this warning, but you can also resolve it by ensuring that the object you're passing conforms to the ChartboostDelegate protocol.

 


 

Add your app ID and app signature.

 


 

To show a static or video interstitial ad:

  • [Chartboost showInterstitial:CBLocationHomeScreen]; shows the interstitial at location HomeScreen. See Chartboost.h for available location options.
  • For customized control over how ads behave in your game, the Chartboost SDK also offers more features such as caching, delegate methods, and named locations.
  • Learn more about Chartboost video ads.
Chartboost calls should always be made from a main – not background – thread, or these calls may time out!

 


 

To show a rewarded video ad:

  • [Chartboost showRewardedVideo:CBLocationMainMenu]; shows the rewarded video pre-roll message and video ad at location MainMenu. See Chartboost.h for available location options.
  • For customized control over how ads behave in your game, the Chartboost SDK also offers more features such as caching, delegate methods, and named locations.
  • Learn more about Chartboost video ads.
Chartboost calls should always be made from a main – not background – thread, or these calls may time out!

 


 

Test your integration.

  • Build and run your project from Xcode on a device or Simulator.
  • If you have an active publishing campaign and have integrated "show interstitial" or "show rewarded video" calls, you should see live ads.
  • If you don't have any publishing campaigns and you've still integrated these calls, you can use Test Mode to see if test ads show up.
  • Why can't I see ads in my game?

 


 

Check the SDK icon in the Chartboost dashboard.

  • Go to your app's App Settings > Basic Settings in your dashboard.
  • When our servers successfully receive a bootup call from our SDK using your app ID, the SDK icon underneath your app’s icon will turn from gray to green.

 


 

w00t! You just integrated the Chartboost SDK into your app!

Now you can start a campaign ▶

 


 

Check out more Chartboost SDK features

  • Caching: Speed up load times for ads and MoreApps pages by storing them locally on devices.
  • Chartboost Video: Add beautiful, high-quality video ads to give players the best in-game experience.
  • Named locations: Fine-tune your campaign targeting and ad frequency from the dashboard.
  • Delegate methods: Gain more control over how your game behaves around ads.
  • MoreApps: Create a custom "see more games" page in your app to advertise your own games or publish other developers' ads.
  • Post-Install Analytics: For games with in-app purchases. Unlock useful data about players' buying behavior to optimize campaigns or retargeting.
  • Mediation: Show your ads along a waterfall of other top-quality networks.

 


 

Best practices

  • As noted in the iOS Human Interface Guidelines, it's good practice to show interstitials only after the user has played your game for the first time.
  • You can use this Chartboost SDK delegate method to prevent interstitials until the second initialization call:
// For Chartboost SDKs v5.0+:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions       
{
    .
    .
    // Initialize the Chartboost library
    [Chartboost startWithAppId:@"YOUR_CHARTBOOST_APP_ID" 
                  appSignature:@"YOUR_CHARTBOOST_APP_SIGNATURE" 
                      delegate:self];
    // Prevent interstitials until after the user has played your game for the first time
    [Chartboost setShouldRequestInterstitialsInFirstSession:NO]
    .
    .
}


// For older Chartboost SDKs:
- (BOOL)shouldRequestInterstitialsInFirstSession {
    return NO;
}

 


 

You might also like...
  • Error codes: Common problems and their solutions when integrating the SDK for iOS.
  • CocoaPods for iOS: Quickly and easily add the latest version of the Chartboost SDK for iOS.

 

▲ Back to top